From patchwork Mon Jan 31 18:48:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jussi Kivilinna X-Patchwork-Id: 520661 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0VImsJh001510 for ; Mon, 31 Jan 2011 18:48:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755874Ab1AaSsw (ORCPT ); Mon, 31 Jan 2011 13:48:52 -0500 Received: from sinikuusama.dnainternet.net ([83.102.40.134]:41922 "EHLO sinikuusama.dnainternet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755849Ab1AaSsw (ORCPT ); Mon, 31 Jan 2011 13:48:52 -0500 Received: from localhost (localhost [127.0.0.1]) by sinikuusama.dnainternet.net (Postfix) with ESMTP id C6E532C924; Mon, 31 Jan 2011 20:48:50 +0200 (EET) X-Virus-Scanned: DNA Postiturva at dnainternet.net X-Spam-Flag: NO X-Spam-Score: -1.44 X-Spam-Level: X-Spam-Status: No, score=-1.44 tagged_above=-9999 required=6 tests=[ALL_TRUSTED=-1.44] Received: from sinikuusama.dnainternet.net ([83.102.40.134]) by localhost (sinikuusama.dnainternet.net [127.0.0.1]) (amavisd-new, port 10041) with ESMTP id 7Y3qUmwRdBJE; Mon, 31 Jan 2011 20:48:50 +0200 (EET) Received: from luumupuu.dnainternet.net (luumupuu.dnainternet.net [83.102.40.213]) by sinikuusama.dnainternet.net (Postfix) with ESMTP id 565092C913; Mon, 31 Jan 2011 20:48:50 +0200 (EET) Received: from fate.lan (dyn2-85-23-163-224.psoas.suomi.net [85.23.163.224]) by luumupuu.dnainternet.net (Postfix) with ESMTP id E63E82BB17; Mon, 31 Jan 2011 20:48:44 +0200 (EET) Subject: [PATCH 11/22] mac80211: fix race between next beacon dtim and ieee80211_get_buffered_bc To: linux-wireless@vger.kernel.org From: Jussi Kivilinna Cc: Christian Lamparter , Daniel Drake , "John W. Linville" , Ulrich Kunitz Date: Mon, 31 Jan 2011 20:48:44 +0200 Message-ID: <20110131184844.10044.33884.stgit@fate.lan> In-Reply-To: <20110131184657.10044.98610.stgit@fate.lan> References: <20110131184657.10044.98610.stgit@fate.lan> User-Agent: StGit/0.15 MIME-Version: 1.0 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.6 (demeter1.kernel.org [140.211.167.41]); Mon, 31 Jan 2011 18:48:55 +0000 (UTC) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index c47d7c0..f71ed31 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -225,6 +225,7 @@ struct ieee80211_if_ap { struct sk_buff_head ps_bc_buf; atomic_t num_sta_ps; /* number of stations in PS mode */ int dtim_count; + bool dtim_bc_mc; }; struct ieee80211_if_wds { diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index ffc6749..1c8cf41 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2178,6 +2178,8 @@ static void ieee80211_beacon_add_tim(struct ieee80211_if_ap *bss, if (bss->dtim_count == 0 && !skb_queue_empty(&bss->ps_bc_buf)) aid0 = 1; + bss->dtim_bc_mc = aid0 == 1; + if (have_bits) { /* Find largest even number N1 so that bits numbered 1 through * (N1 x 8) - 1 in the bitmap are 0 and number N2 so that bits @@ -2548,7 +2550,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, if (sdata->vif.type != NL80211_IFTYPE_AP || !beacon || !beacon->head) goto out; - if (bss->dtim_count != 0) + if (bss->dtim_count != 0 || !bss->dtim_bc_mc) goto out; /* send buffered bc/mc only after DTIM beacon */ while (1) {