ipv6: flowlabel: fl6_sock_lookup() must use atomic_inc_not_zero
Subsystems (4)
PATCH 1/1 ipv6: flowlabel: fl6_sock_lookup() must use atomic_inc_not_zero
RCU 101 : Before taking a refcount, make sure the object is not already
scheduled for deletion.
Fixes 18367681a10b ("ipv6 flowlabel: Convert np->ipv6_fl_list to RCU.")
Signed-off-by Eric Dumazet <[email protected]>
Cc Willem de Bruijn <[email protected]>
--- net/ipv6/ip6_flowlabel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv6/ip6_flowlabel.c +2 -2
@@ -254,9 +254,9 @@ struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label)rcu_read_lock_bh ();for_each_sk_fl_rcu (np, sfl) {struct ip6_flowlabel *fl = sfl->fl; -if (fl->label == label) { + +if (fl->label == label &&atomic_inc_not_zero (&fl->users)) { fl->lastuse = jiffies; -atomic_inc (&fl->users);rcu_read_unlock_bh ();return fl; }
Signature · 1 line
2.22.0.rc1.311.g5d7573a151-goog
Quoted 4 lines · Eric Dumazet
RCU 101 : Before taking a refcount, make sure the object is not already
scheduled for deletion.
I will send a V2, there is a second atomic_inc() which needs to be changed in ipv6_flowlabel_opt()