Search Linux Wireless

[PATCH 12/13] mac80211: prevent master device from going up without ieee80211 qdisc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Michael Wu <flamingice@xxxxxxxxxxxx>

This patch ensures that the master device cannot be opened without the
ieee80211 qdisc installed.

Signed-off-by: Michael Wu <flamingice@xxxxxxxxxxxx>
---

 net/mac80211/ieee80211.c |    6 ++++++
 net/mac80211/wme.c       |    6 ++++++
 net/mac80211/wme.h       |    1 +
 3 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 17c6fde..e876e04 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -2270,6 +2270,12 @@ static int ieee80211_master_open(struct net_device *dev)
 	struct ieee80211_sub_if_data *sdata;
 	int res = -EOPNOTSUPP;
 
+	if (!ieee80211_qdisc_installed(dev)) {
+		printk(KERN_ERR "%s: ieee80211 qdisc not installed\n",
+		       dev->name);
+		return res;
+	}
+
 	read_lock(&local->sub_if_lock);
 	list_for_each_entry(sdata, &local->sub_if_list, list) {
 		if (sdata->dev != dev && netif_running(sdata->dev)) {
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 79b4305..1cb6358 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -655,6 +655,12 @@ void ieee80211_install_qdisc(struct net_device *dev)
 }
 
 
+int ieee80211_qdisc_installed(struct net_device *dev)
+{
+	return dev->qdisc_sleeping->ops == &wme_qdisc_ops;
+}
+
+
 int ieee80211_wme_register(void)
 {
 	int err = 0;
diff --git a/net/mac80211/wme.h b/net/mac80211/wme.h
index 90add6e..2a79262 100644
--- a/net/mac80211/wme.h
+++ b/net/mac80211/wme.h
@@ -31,6 +31,7 @@ ieee80211_txrx_result
 ieee80211_rx_h_remove_qos_control(struct ieee80211_txrx_data *rx);
 
 void ieee80211_install_qdisc(struct net_device *dev);
+int ieee80211_qdisc_installed(struct net_device *dev);
 
 int ieee80211_wme_register(void);
 void ieee80211_wme_unregister(void);

-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux