Skip to contentSkip to conversation

mac80211: prevent a wme_qdiscop_init BUG on other devices

PATCH Applied Michael Wu 2 participants 2 messages May 4, 2007 mac80211

lore
Share & tools
lore

Michael Wu

author
#0 lore raw

PATCH v2 1/1 mac80211: prevent a wme_qdiscop_init BUG on other devices

From: Michael Wu <[email protected]>

This prevents a BUG if the ieee80211 qdisc is being registered on a net dev without ieee80211_ptr set. It also ensures the device is a mac80211 device.

---

 net/mac80211/wme.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
net/mac80211/wme.c +10 -2
index 3823f15..89ce815 100644
@@ -389,10 +389,15 @@ static int wme_qdiscop_init(struct Qdisc *qd, struct rtattr *opt)
 {
 	struct ieee80211_sched_data *q = qdisc_priv(qd);
 	struct net_device *dev = qd->dev;
-	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-	int queues = local->hw.queues;
+	struct ieee80211_local *local;
+	int queues;
 	int err = 0, i;
 
+	/* check that device is a mac80211 device */
+	if (!dev->ieee80211_ptr ||
+	    dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid)
+		return -EINVAL;
+
 	/* check this device is an ieee80211 master type device */
 	if (dev->type != ARPHRD_IEEE80211)
 		return -EINVAL;
@@ -406,6 +411,9 @@ static int wme_qdiscop_init(struct Qdisc *qd, struct rtattr *opt)
 	if (qd->flags & TCQ_F_INGRESS)
 		return -EINVAL;
 
+	local = wdev_priv(dev->ieee80211_ptr);
+	queues = local->hw.queues;
+
 	/* if options were passed in, set them */
 	if (opt) {
 		err = wme_qdiscop_tune(qd, opt);
Applied
#1 lore raw
Quoted 2 lines · Michael Wu

This prevents a BUG if the ieee80211 qdisc is being registered on a net dev without ieee80211_ptr set. It also ensures the device is a mac80211 device.

Applied, thanks!

Jiri

Signature · 2 lines
Jiri Benc
SUSE Labs