Skip to content

Commit

Permalink
ip6mr: do not acquire mrt_lock in pim6_rcv()
Browse files Browse the repository at this point in the history
rcu_read_lock() protection is more than enough.

vif_dev_read() supports either mrt_lock or rcu_read_lock().

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jun 24, 2022
1 parent 3493a5b commit 6d08658
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions net/ipv6/ip6mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,12 +559,11 @@ static int pim6_rcv(struct sk_buff *skb)

if (ip6mr_fib_lookup(net, &fl6, &mrt) < 0)
goto drop;
reg_vif_num = mrt->mroute_reg_vif_num;

read_lock(&mrt_lock);
/* Pairs with WRITE_ONCE() in mif6_add()/mif6_delete() */
reg_vif_num = READ_ONCE(mrt->mroute_reg_vif_num);
if (reg_vif_num >= 0)
reg_dev = vif_dev_read(&mrt->vif_table[reg_vif_num]);
read_unlock(&mrt_lock);

if (!reg_dev)
goto drop;
Expand Down

0 comments on commit 6d08658

Please sign in to comment.