diff options
author | Jouni Malinen <jouni.malinen@atheros.com> | 2009-03-20 15:21:18 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-03-27 20:13:05 -0400 |
commit | 35a8efe1a67ba5d7bb7492f67f52ed2aa4925892 (patch) | |
tree | 7783b27bebbc3f113a15ba0b884c24fb627c37a2 /net/wireless | |
parent | 255e737eab645ec6037baeca04a5e0a7c3b1f459 (diff) |
nl80211: Check that netif_runnin is true in cfg80211 code
We do not want to require all the drivers using cfg80211 to need to do
this or to be prepared to handle these commands when the interface is
down.
Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/nl80211.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 6f38ee7a3c92..6bb73a3a3391 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -1556,6 +1556,11 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) | |||
1556 | goto out; | 1556 | goto out; |
1557 | } | 1557 | } |
1558 | 1558 | ||
1559 | if (!netif_running(dev)) { | ||
1560 | err = -ENETDOWN; | ||
1561 | goto out; | ||
1562 | } | ||
1563 | |||
1559 | err = drv->ops->add_station(&drv->wiphy, dev, mac_addr, ¶ms); | 1564 | err = drv->ops->add_station(&drv->wiphy, dev, mac_addr, ¶ms); |
1560 | 1565 | ||
1561 | out: | 1566 | out: |
@@ -1808,6 +1813,11 @@ static int nl80211_set_mpath(struct sk_buff *skb, struct genl_info *info) | |||
1808 | goto out; | 1813 | goto out; |
1809 | } | 1814 | } |
1810 | 1815 | ||
1816 | if (!netif_running(dev)) { | ||
1817 | err = -ENETDOWN; | ||
1818 | goto out; | ||
1819 | } | ||
1820 | |||
1811 | err = drv->ops->change_mpath(&drv->wiphy, dev, dst, next_hop); | 1821 | err = drv->ops->change_mpath(&drv->wiphy, dev, dst, next_hop); |
1812 | 1822 | ||
1813 | out: | 1823 | out: |
@@ -1846,6 +1856,11 @@ static int nl80211_new_mpath(struct sk_buff *skb, struct genl_info *info) | |||
1846 | goto out; | 1856 | goto out; |
1847 | } | 1857 | } |
1848 | 1858 | ||
1859 | if (!netif_running(dev)) { | ||
1860 | err = -ENETDOWN; | ||
1861 | goto out; | ||
1862 | } | ||
1863 | |||
1849 | err = drv->ops->add_mpath(&drv->wiphy, dev, dst, next_hop); | 1864 | err = drv->ops->add_mpath(&drv->wiphy, dev, dst, next_hop); |
1850 | 1865 | ||
1851 | out: | 1866 | out: |
@@ -2380,6 +2395,11 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | |||
2380 | goto out; | 2395 | goto out; |
2381 | } | 2396 | } |
2382 | 2397 | ||
2398 | if (!netif_running(dev)) { | ||
2399 | err = -ENETDOWN; | ||
2400 | goto out; | ||
2401 | } | ||
2402 | |||
2383 | if (drv->scan_req) { | 2403 | if (drv->scan_req) { |
2384 | err = -EBUSY; | 2404 | err = -EBUSY; |
2385 | goto out; | 2405 | goto out; |
@@ -2641,6 +2661,11 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info) | |||
2641 | goto out; | 2661 | goto out; |
2642 | } | 2662 | } |
2643 | 2663 | ||
2664 | if (!netif_running(dev)) { | ||
2665 | err = -ENETDOWN; | ||
2666 | goto out; | ||
2667 | } | ||
2668 | |||
2644 | if (!info->attrs[NL80211_ATTR_MAC]) { | 2669 | if (!info->attrs[NL80211_ATTR_MAC]) { |
2645 | err = -EINVAL; | 2670 | err = -EINVAL; |
2646 | goto out; | 2671 | goto out; |
@@ -2709,6 +2734,11 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info) | |||
2709 | goto out; | 2734 | goto out; |
2710 | } | 2735 | } |
2711 | 2736 | ||
2737 | if (!netif_running(dev)) { | ||
2738 | err = -ENETDOWN; | ||
2739 | goto out; | ||
2740 | } | ||
2741 | |||
2712 | if (!info->attrs[NL80211_ATTR_MAC] || | 2742 | if (!info->attrs[NL80211_ATTR_MAC] || |
2713 | !info->attrs[NL80211_ATTR_SSID]) { | 2743 | !info->attrs[NL80211_ATTR_SSID]) { |
2714 | err = -EINVAL; | 2744 | err = -EINVAL; |
@@ -2767,6 +2797,11 @@ static int nl80211_deauthenticate(struct sk_buff *skb, struct genl_info *info) | |||
2767 | goto out; | 2797 | goto out; |
2768 | } | 2798 | } |
2769 | 2799 | ||
2800 | if (!netif_running(dev)) { | ||
2801 | err = -ENETDOWN; | ||
2802 | goto out; | ||
2803 | } | ||
2804 | |||
2770 | if (!info->attrs[NL80211_ATTR_MAC]) { | 2805 | if (!info->attrs[NL80211_ATTR_MAC]) { |
2771 | err = -EINVAL; | 2806 | err = -EINVAL; |
2772 | goto out; | 2807 | goto out; |
@@ -2821,6 +2856,11 @@ static int nl80211_disassociate(struct sk_buff *skb, struct genl_info *info) | |||
2821 | goto out; | 2856 | goto out; |
2822 | } | 2857 | } |
2823 | 2858 | ||
2859 | if (!netif_running(dev)) { | ||
2860 | err = -ENETDOWN; | ||
2861 | goto out; | ||
2862 | } | ||
2863 | |||
2824 | if (!info->attrs[NL80211_ATTR_MAC]) { | 2864 | if (!info->attrs[NL80211_ATTR_MAC]) { |
2825 | err = -EINVAL; | 2865 | err = -EINVAL; |
2826 | goto out; | 2866 | goto out; |