* [PATCH V2] mac80211: Fixing sparse warning at sta_info.c
[not found] <82612>
@ 2011-12-16 6:17 ` Yogesh Ashok Powar
2011-12-19 19:39 ` John W. Linville
0 siblings, 1 reply; 3+ messages in thread
From: Yogesh Ashok Powar @ 2011-12-16 6:17 UTC (permalink / raw)
To: linux-wireless
Cc: John W. Linville, Johannes Berg, Yogesh Ashok Powar, Nishant Sarmukadam
The commit 42624d4913a00219a8fdbb4bafd634d1d843be85
created following sparse warning
>net/mac80211/sta_info.c:965:24: warning: incorrect type in assignment (different address spaces)
>net/mac80211/sta_info.c:965:24: expected struct tid_ampdu_tx *tid_tx
>net/mac80211/sta_info.c:965:24: got struct tid_ampdu_tx [noderef] <asn:4>*<noident>
Making use of rcu_dereference_protected to fix the problem.
V2:
- Replacing rcu_dereference with rcu_dereference_protected
as suggested by Johannes.
- Adding mutex_lock/unlock to satisfy the condition at
rcu_dereference_protected
Cc: Nishant Sarmukadam <nishants@marvell.com>
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
---
net/mac80211/sta_info.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index c6ca9bd..e4307b7 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -959,10 +959,13 @@ static int __must_check __sta_info_destroy(struct sta_info *sta)
* until the aggregation stop completes. Refer
* http://thread.gmane.org/gmane.linux.kernel.wireless.general/81936
*/
+
+ mutex_lock(&sta->ampdu_mlme.mtx);
+
for (i = 0; i < STA_TID_NUM; i++) {
- if (!sta->ampdu_mlme.tid_tx[i])
+ tid_tx = rcu_dereference_protected_tid_tx(sta, i);
+ if (!tid_tx)
continue;
- tid_tx = sta->ampdu_mlme.tid_tx[i];
if (skb_queue_len(&tid_tx->pending)) {
#ifdef CONFIG_MAC80211_HT_DEBUG
wiphy_debug(local->hw.wiphy, "TX A-MPDU purging %d "
@@ -974,6 +977,8 @@ static int __must_check __sta_info_destroy(struct sta_info *sta)
kfree_rcu(tid_tx, rcu_head);
}
+ mutex_unlock(&sta->ampdu_mlme.mtx);
+
__sta_info_free(local, sta);
return 0;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2] mac80211: Fixing sparse warning at sta_info.c
2011-12-16 6:17 ` [PATCH V2] mac80211: Fixing sparse warning at sta_info.c Yogesh Ashok Powar
@ 2011-12-19 19:39 ` John W. Linville
2011-12-19 20:13 ` John W. Linville
0 siblings, 1 reply; 3+ messages in thread
From: John W. Linville @ 2011-12-19 19:39 UTC (permalink / raw)
To: Yogesh Ashok Powar
Cc: linux-wireless, Johannes Berg, Yogesh Ashok Powar, Nishant Sarmukadam
Applying: mac80211: Fixing sparse warning at sta_info.c
error: patch failed: net/mac80211/sta_info.c:974
error: net/mac80211/sta_info.c: patch does not apply
What tree did you use as a base for your patch?
On Fri, Dec 16, 2011 at 11:47:15AM +0530, Yogesh Ashok Powar wrote:
> The commit 42624d4913a00219a8fdbb4bafd634d1d843be85
> created following sparse warning
> >net/mac80211/sta_info.c:965:24: warning: incorrect type in assignment (different address spaces)
> >net/mac80211/sta_info.c:965:24: expected struct tid_ampdu_tx *tid_tx
> >net/mac80211/sta_info.c:965:24: got struct tid_ampdu_tx [noderef] <asn:4>*<noident>
>
> Making use of rcu_dereference_protected to fix the problem.
>
> V2:
> - Replacing rcu_dereference with rcu_dereference_protected
> as suggested by Johannes.
> - Adding mutex_lock/unlock to satisfy the condition at
> rcu_dereference_protected
>
> Cc: Nishant Sarmukadam <nishants@marvell.com>
> Reported-by: Johannes Berg <johannes@sipsolutions.net>
> Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
> ---
> net/mac80211/sta_info.c | 9 +++++++--
> 1 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
> index c6ca9bd..e4307b7 100644
> --- a/net/mac80211/sta_info.c
> +++ b/net/mac80211/sta_info.c
> @@ -959,10 +959,13 @@ static int __must_check __sta_info_destroy(struct sta_info *sta)
> * until the aggregation stop completes. Refer
> * http://thread.gmane.org/gmane.linux.kernel.wireless.general/81936
> */
> +
> + mutex_lock(&sta->ampdu_mlme.mtx);
> +
> for (i = 0; i < STA_TID_NUM; i++) {
> - if (!sta->ampdu_mlme.tid_tx[i])
> + tid_tx = rcu_dereference_protected_tid_tx(sta, i);
> + if (!tid_tx)
> continue;
> - tid_tx = sta->ampdu_mlme.tid_tx[i];
> if (skb_queue_len(&tid_tx->pending)) {
> #ifdef CONFIG_MAC80211_HT_DEBUG
> wiphy_debug(local->hw.wiphy, "TX A-MPDU purging %d "
> @@ -974,6 +977,8 @@ static int __must_check __sta_info_destroy(struct sta_info *sta)
> kfree_rcu(tid_tx, rcu_head);
> }
>
> + mutex_unlock(&sta->ampdu_mlme.mtx);
> +
> __sta_info_free(local, sta);
>
> return 0;
> --
> 1.7.5.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH V2] mac80211: Fixing sparse warning at sta_info.c
2011-12-19 19:39 ` John W. Linville
@ 2011-12-19 20:13 ` John W. Linville
0 siblings, 0 replies; 3+ messages in thread
From: John W. Linville @ 2011-12-19 20:13 UTC (permalink / raw)
To: Yogesh Ashok Powar
Cc: linux-wireless, Johannes Berg, Yogesh Ashok Powar, Nishant Sarmukadam
On Mon, Dec 19, 2011 at 02:39:57PM -0500, John W. Linville wrote:
> Applying: mac80211: Fixing sparse warning at sta_info.c
> error: patch failed: net/mac80211/sta_info.c:974
> error: net/mac80211/sta_info.c: patch does not apply
>
> What tree did you use as a base for your patch?
NM -- it was simple to fix-up, even if 'git apply' couldn't figure
it out...
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-12-19 20:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <82612>
2011-12-16 6:17 ` [PATCH V2] mac80211: Fixing sparse warning at sta_info.c Yogesh Ashok Powar
2011-12-19 19:39 ` John W. Linville
2011-12-19 20:13 ` John W. Linville
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.