Skip to content
  • Bob Peterson's avatar
    tipc: Fix tipc_sk_reinit handling of -EAGAIN · 2185dbac
    Bob Peterson authored
    [ Upstream commit 6c7e983b ]
    
    In 9dbbfb0a
    
     function tipc_sk_reinit
    had additional logic added to loop in the event that function
    rhashtable_walk_next() returned -EAGAIN. No worries.
    
    However, if rhashtable_walk_start returns -EAGAIN, it does "continue",
    and therefore skips the call to rhashtable_walk_stop(). That has
    the effect of calling rcu_read_lock() without its paired call to
    rcu_read_unlock(). Since rcu_read_lock() may be nested, the problem
    may not be apparent for a while, especially since resize events may
    be rare. But the comments to rhashtable_walk_start() state:
    
     * ...Note that we take the RCU lock in all
     * cases including when we return an error.  So you must always call
     * rhashtable_walk_stop to clean up.
    
    This patch replaces the continue with a goto and label to ensure a
    matching call to rhashtable_walk_stop().
    
    Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
    Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    2185dbac