From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Paul E. McKenney" Subject: [PATCH tip/core/rcu 10/13] mac80211: Apply rcu_access_pointer() to avoid sparse false positive Date: Tue, 24 Sep 2013 18:35:13 -0700 Message-ID: <1380072916-31557-10-git-send-email-paulmck@linux.vnet.ibm.com> References: <20130925013451.GA31260@linux.vnet.ibm.com> <1380072916-31557-1-git-send-email-paulmck@linux.vnet.ibm.com> Cc: mingo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, laijs-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org, dipankar-xthvdsQ13ZrQT0dZR+AlfA@public.gmane.org, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org, mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org, josh-iaAMLnmF4UmaiuxdJuQwMA@public.gmane.org, niv-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org, tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org, peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org, rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org, dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, darren-P76s1CtE8BHQT0dZR+AlfA@public.gmane.org, fweisbec-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, sbw-3s7WtUTddSA@public.gmane.org, "Paul E. McKenney" , "John W. Linville" , Johannes Berg , "David S. Miller" , linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Return-path: In-Reply-To: <1380072916-31557-1-git-send-email-paulmck-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> Sender: linux-wireless-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: netdev.vger.kernel.org From: "Paul E. McKenney" The sparse checking for rcu_assign_pointer() was recently upgraded to reject non-__kernel address spaces. This also rejects __rcu, which is almost always the right thing to do. However, the uses in sta_info_hash_del() are legitimate: They is assigning a pointer to an element from an RCU-protected list, and all elements of this list are already visible to caller. This commit therefore silences this false positive by laundering the pointer using rcu_access_pointer() as suggested by Josh Triplett. Reported-by: kbuild test robot Signed-off-by: Paul E. McKenney Cc: "John W. Linville" Cc: Johannes Berg Cc: "David S. Miller" Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org --- net/mac80211/sta_info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index aeb967a..d18ab89 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -75,7 +75,7 @@ static int sta_info_hash_del(struct ieee80211_local *local, return -ENOENT; if (s == sta) { rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)], - s->hnext); + rcu_access_pointer(s->hnext)); return 0; } @@ -84,7 +84,7 @@ static int sta_info_hash_del(struct ieee80211_local *local, s = rcu_dereference_protected(s->hnext, lockdep_is_held(&local->sta_mtx)); if (rcu_access_pointer(s->hnext)) { - rcu_assign_pointer(s->hnext, sta->hnext); + rcu_assign_pointer(s->hnext, rcu_access_pointer(sta->hnext)); return 0; } -- 1.8.1.5 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html