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>
This commit is contained in:

committed by
John W. Linville

parent
255e737eab
commit
35a8efe1a6
@@ -1556,6 +1556,11 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!netif_running(dev)) {
|
||||
err = -ENETDOWN;
|
||||
goto out;
|
||||
}
|
||||
|
||||
err = drv->ops->add_station(&drv->wiphy, dev, mac_addr, ¶ms);
|
||||
|
||||
out:
|
||||
@@ -1808,6 +1813,11 @@ static int nl80211_set_mpath(struct sk_buff *skb, struct genl_info *info)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!netif_running(dev)) {
|
||||
err = -ENETDOWN;
|
||||
goto out;
|
||||
}
|
||||
|
||||
err = drv->ops->change_mpath(&drv->wiphy, dev, dst, next_hop);
|
||||
|
||||
out:
|
||||
@@ -1846,6 +1856,11 @@ static int nl80211_new_mpath(struct sk_buff *skb, struct genl_info *info)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!netif_running(dev)) {
|
||||
err = -ENETDOWN;
|
||||
goto out;
|
||||
}
|
||||
|
||||
err = drv->ops->add_mpath(&drv->wiphy, dev, dst, next_hop);
|
||||
|
||||
out:
|
||||
@@ -2380,6 +2395,11 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!netif_running(dev)) {
|
||||
err = -ENETDOWN;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (drv->scan_req) {
|
||||
err = -EBUSY;
|
||||
goto out;
|
||||
@@ -2641,6 +2661,11 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!netif_running(dev)) {
|
||||
err = -ENETDOWN;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!info->attrs[NL80211_ATTR_MAC]) {
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
@@ -2709,6 +2734,11 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!netif_running(dev)) {
|
||||
err = -ENETDOWN;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!info->attrs[NL80211_ATTR_MAC] ||
|
||||
!info->attrs[NL80211_ATTR_SSID]) {
|
||||
err = -EINVAL;
|
||||
@@ -2767,6 +2797,11 @@ static int nl80211_deauthenticate(struct sk_buff *skb, struct genl_info *info)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!netif_running(dev)) {
|
||||
err = -ENETDOWN;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!info->attrs[NL80211_ATTR_MAC]) {
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
@@ -2821,6 +2856,11 @@ static int nl80211_disassociate(struct sk_buff *skb, struct genl_info *info)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!netif_running(dev)) {
|
||||
err = -ENETDOWN;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!info->attrs[NL80211_ATTR_MAC]) {
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
|
Reference in New Issue
Block a user