Commit 862bad0f authored by Eric Dumazet's avatar Eric Dumazet Committed by Kamal Mostafa

ipv6: fix a lockdep splat

commit 44c3d0c1 upstream.

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: 18367681 ("ipv6 flowlabel: Convert np->ipv6_fl_list to RCU.")
Reported-by: default avatarDave Jones <davej@codemonkey.org.uk>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent fdf3936e
...@@ -529,12 +529,13 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen) ...@@ -529,12 +529,13 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen)
case IPV6_FL_A_PUT: case IPV6_FL_A_PUT:
spin_lock_bh(&ip6_sk_fl_lock); spin_lock_bh(&ip6_sk_fl_lock);
for (sflp = &np->ipv6_fl_list; 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) { sflp = &sfl->next) {
if (sfl->fl->label == freq.flr_label) { if (sfl->fl->label == freq.flr_label) {
if (freq.flr_label == (np->flow_label&IPV6_FLOWLABEL_MASK)) if (freq.flr_label == (np->flow_label&IPV6_FLOWLABEL_MASK))
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); spin_unlock_bh(&ip6_sk_fl_lock);
fl_release(sfl->fl); fl_release(sfl->fl);
kfree_rcu(sfl, rcu); kfree_rcu(sfl, rcu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment