From: Eric Dumazet Date: Wed, 3 Feb 2016 01:55:01 +0000 (-0800) Subject: ipv6: fix a lockdep splat X-Git-Tag: v4.1.12-92~150^2~179 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=53b806295d2ea29f7ba0b35166d153af981a7412;p=users%2Fjedix%2Flinux-maple.git ipv6: fix a lockdep splat Orabug: 23330945 Orabug: 23330945 [ Upstream commit 44c3d0c1c0a880354e9de5d94175742e2c7c9683 ] Silence lockdep false positive about rcu_dereference() being used in the wrong context. First one should use rcu_dereference_protected() as we own the spinlock. Second one should be a normal assignation, as no barrier is needed. Fixes: 18367681a10bd ("ipv6 flowlabel: Convert np->ipv6_fl_list to RCU.") Reported-by: Dave Jones Signed-off-by: Eric Dumazet Acked-by: Hannes Frederic Sowa Signed-off-by: David S. Miller Signed-off-by: Sasha Levin (cherry picked from commit 6c92a8f0502d3e9a9036473408f7f67b58f22ea9) Signed-off-by: Dan Duval (cherry picked from commit 8ca54cd2d7e8d64c008d5f804518494740ddf711) Signed-off-by: Dan Duval --- diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index d491125011c4d..db939e4ac68a8 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c @@ -540,12 +540,13 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen) } spin_lock_bh(&ip6_sk_fl_lock); for (sflp = &np->ipv6_fl_list; - (sfl = rcu_dereference(*sflp)) != NULL; + (sfl = rcu_dereference_protected(*sflp, + lockdep_is_held(&ip6_sk_fl_lock))) != NULL; sflp = &sfl->next) { if (sfl->fl->label == freq.flr_label) { if (freq.flr_label == (np->flow_label&IPV6_FLOWLABEL_MASK)) np->flow_label &= ~IPV6_FLOWLABEL_MASK; - *sflp = rcu_dereference(sfl->next); + *sflp = sfl->next; spin_unlock_bh(&ip6_sk_fl_lock); fl_release(sfl->fl); kfree_rcu(sfl, rcu);