diff mbox

[RFCv4,2/2] mac80211: free ps->bc_buf skbs on vlan device stop

Message ID 1360695107-5721-3-git-send-email-michael-dev@fami-braun.de (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

michael-dev Feb. 12, 2013, 6:51 p.m. UTC
When the vlan device is removed, ps->bc_buf processing can no longer
send its frames.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
---
V4: Add this patch. Does it need locks? Which?

 net/mac80211/iface.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Johannes Berg Feb. 13, 2013, 9:30 a.m. UTC | #1
On Tue, 2013-02-12 at 19:51 +0100, Michael Braun wrote:
> When the vlan device is removed, ps->bc_buf processing can no longer
> send its frames.
> 
> Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
> ---
> V4: Add this patch. Does it need locks? Which?

Yes, the bc_buf has a spinlock itself, which we never use because we
never walk the queue (we use skb_dequeue() which has locking built-in)

Also this patch needs to be the first, otherwise during bisect the
problem might show up.

johannes

--
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
diff mbox

Patch

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 0a36dc6..b7a57b7 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -748,6 +748,7 @@  static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
 	struct sk_buff *skb, *tmp;
 	u32 hw_reconf_flags = 0;
 	int i, flushed;
+	struct ps_data *ps;
 
 	clear_bit(SDATA_STATE_RUNNING, &sdata->state);
 
@@ -826,6 +827,17 @@  static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
 					 u.vlan.list)
 			dev_close(vlan->dev);
 		WARN_ON(!list_empty(&sdata->u.ap.vlans));
+	} else if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
+		/* remove all packets in parent bc_buf pointing to this dev */
+		ps = &sdata->bss->ps;
+
+		skb_queue_walk_safe(&ps->bc_buf, skb, tmp) {
+			if (skb->dev == sdata->dev) {
+				__skb_unlink(skb, &ps->bc_buf);
+				local->total_ps_buffered--;
+				kfree_skb(skb);
+			}
+		}
 	} else if (sdata->vif.type == NL80211_IFTYPE_STATION) {
 		ieee80211_mgd_stop(sdata);
 	}