From patchwork Tue Apr 6 09:18:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 90754 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o369MhwH023015 for ; Tue, 6 Apr 2010 09:22:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751617Ab0DFJWm (ORCPT ); Tue, 6 Apr 2010 05:22:42 -0400 Received: from he.sipsolutions.net ([78.46.109.217]:47117 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751429Ab0DFJWl (ORCPT ); Tue, 6 Apr 2010 05:22:41 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1Nz4zX-00078K-GH; Tue, 06 Apr 2010 11:22:39 +0200 Message-Id: <20100406092141.174938785@sipsolutions.net> User-Agent: quilt/0.48-1 Date: Tue, 06 Apr 2010 11:18:42 +0200 From: Johannes Berg To: John Linville Cc: linux-wireless@vger.kernel.org Subject: [PATCH 1/7] mac80211: annotate station rcu dereferences References: <20100406091841.549805267@sipsolutions.net> Content-Disposition: inline; filename=004-mac80211-rcu-deref-sta.patch Mime-Version: 1.0 X-Mailer: Evolution 2.29.92.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 06 Apr 2010 09:22:48 +0000 (UTC) --- wireless-testing.orig/net/mac80211/sta_info.c 2010-04-06 09:07:30.000000000 +0200 +++ wireless-testing/net/mac80211/sta_info.c 2010-04-06 09:07:33.000000000 +0200 @@ -93,12 +93,18 @@ struct sta_info *sta_info_get(struct iee struct ieee80211_local *local = sdata->local; struct sta_info *sta; - sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]); + sta = rcu_dereference_check(local->sta_hash[STA_HASH(addr)], + rcu_read_lock_held() || + lockdep_is_held(&local->sta_lock) || + lockdep_is_held(&local->sta_mtx)); while (sta) { if (sta->sdata == sdata && memcmp(sta->sta.addr, addr, ETH_ALEN) == 0) break; - sta = rcu_dereference(sta->hnext); + sta = rcu_dereference_check(sta->hnext, + rcu_read_lock_held() || + lockdep_is_held(&local->sta_lock) || + lockdep_is_held(&local->sta_mtx)); } return sta; } @@ -113,13 +119,19 @@ struct sta_info *sta_info_get_bss(struct struct ieee80211_local *local = sdata->local; struct sta_info *sta; - sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]); + sta = rcu_dereference_check(local->sta_hash[STA_HASH(addr)], + rcu_read_lock_held() || + lockdep_is_held(&local->sta_lock) || + lockdep_is_held(&local->sta_mtx)); while (sta) { if ((sta->sdata == sdata || sta->sdata->bss == sdata->bss) && memcmp(sta->sta.addr, addr, ETH_ALEN) == 0) break; - sta = rcu_dereference(sta->hnext); + sta = rcu_dereference_check(sta->hnext, + rcu_read_lock_held() || + lockdep_is_held(&local->sta_lock) || + lockdep_is_held(&local->sta_mtx)); } return sta; } --- wireless-testing.orig/net/mac80211/main.c 2010-04-06 09:07:30.000000000 +0200 +++ wireless-testing/net/mac80211/main.c 2010-04-06 09:07:33.000000000 +0200 @@ -225,11 +225,11 @@ void ieee80211_bss_info_change_notify(st switch (sdata->vif.type) { case NL80211_IFTYPE_AP: sdata->vif.bss_conf.enable_beacon = - !!rcu_dereference(sdata->u.ap.beacon); + !!sdata->u.ap.beacon; break; case NL80211_IFTYPE_ADHOC: sdata->vif.bss_conf.enable_beacon = - !!rcu_dereference(sdata->u.ibss.presp); + !!sdata->u.ibss.presp; break; case NL80211_IFTYPE_MESH_POINT: sdata->vif.bss_conf.enable_beacon = true;