diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-11-01 13:25:40 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-02 15:14:07 -0500 |
commit | c1f9a764cf47686b1f5a0cf87ada68d90056136a (patch) | |
tree | 77bff7f1361deb11e1b3c60470d9d5784c00a771 /net | |
parent | 7400f42e9d765fa0656b432f3ab1245f9710f190 (diff) |
mac80211: check interface is down before type change
For some strange reason the netif_running() check
ended up after the actual type change instead of
before, potentially causing all kinds of problems
if the interface is up while changing the type;
one of the problems manifests itself as a warning:
WARNING: at net/mac80211/iface.c:651 ieee80211_teardown_sdata+0xda/0x1a0 [mac80211]()
Hardware name: Aspire one
Pid: 2596, comm: wpa_supplicant Tainted: G W 2.6.31-10-generic #32-Ubuntu
Call Trace:
[] warn_slowpath_common+0x6d/0xa0
[] warn_slowpath_null+0x15/0x20
[] ieee80211_teardown_sdata+0xda/0x1a0 [mac80211]
[] ieee80211_if_change_type+0x4a/0xc0 [mac80211]
[] ieee80211_change_iface+0x61/0xa0 [mac80211]
[] cfg80211_wext_siwmode+0xc7/0x120 [cfg80211]
[] ioctl_standard_call+0x58/0xf0
(http://www.kerneloops.org/searchweek.php?search=ieee80211_teardown_sdata)
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: stable@kernel.org
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/cfg.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 5608f6c68413..7b5131bd6fa1 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -72,6 +72,9 @@ static int ieee80211_change_iface(struct wiphy *wiphy, | |||
72 | struct ieee80211_sub_if_data *sdata; | 72 | struct ieee80211_sub_if_data *sdata; |
73 | int ret; | 73 | int ret; |
74 | 74 | ||
75 | if (netif_running(dev)) | ||
76 | return -EBUSY; | ||
77 | |||
75 | if (!nl80211_type_check(type)) | 78 | if (!nl80211_type_check(type)) |
76 | return -EINVAL; | 79 | return -EINVAL; |
77 | 80 | ||
@@ -81,9 +84,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy, | |||
81 | if (ret) | 84 | if (ret) |
82 | return ret; | 85 | return ret; |
83 | 86 | ||
84 | if (netif_running(sdata->dev)) | ||
85 | return -EBUSY; | ||
86 | |||
87 | if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len) | 87 | if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len) |
88 | ieee80211_sdata_set_mesh_id(sdata, | 88 | ieee80211_sdata_set_mesh_id(sdata, |
89 | params->mesh_id_len, | 89 | params->mesh_id_len, |