aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx
diff options
context:
space:
mode:
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>2010-10-26 07:24:39 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-11-15 13:25:20 -0500
commitf8d9802f66eda9ff14f7667f99a46b31e9a9e273 (patch)
tree82be7b3bf873ec93749288749942fc17e0052140 /drivers/net/wireless/wl12xx
parentb739a42c921dcb0ae92cc14032b7f75dcba88e3b (diff)
wl1271: Check interface state in op_* functions
Check the state of the interface on op_* function so we don't try to access the hardware in when its off. The mac80211 may call these in some corner cases related, for instance, to the hardware recovery procedure. These accesses cause a kernel crash on at least some SDIO devices, because the bus is not properly claimed in that scenario. Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index bec2b3d78782..c54887c80646 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -1344,8 +1344,10 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
1344 1344
1345 mutex_lock(&wl->mutex); 1345 mutex_lock(&wl->mutex);
1346 1346
1347 if (unlikely(wl->state == WL1271_STATE_OFF)) 1347 if (unlikely(wl->state == WL1271_STATE_OFF)) {
1348 ret = -EAGAIN;
1348 goto out; 1349 goto out;
1350 }
1349 1351
1350 ret = wl1271_ps_elp_wakeup(wl, false); 1352 ret = wl1271_ps_elp_wakeup(wl, false);
1351 if (ret < 0) 1353 if (ret < 0)
@@ -1568,6 +1570,11 @@ static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1568 1570
1569 mutex_lock(&wl->mutex); 1571 mutex_lock(&wl->mutex);
1570 1572
1573 if (unlikely(wl->state == WL1271_STATE_OFF)) {
1574 ret = -EAGAIN;
1575 goto out_unlock;
1576 }
1577
1571 ret = wl1271_ps_elp_wakeup(wl, false); 1578 ret = wl1271_ps_elp_wakeup(wl, false);
1572 if (ret < 0) 1579 if (ret < 0)
1573 goto out_unlock; 1580 goto out_unlock;
@@ -1708,8 +1715,10 @@ static int wl1271_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
1708 1715
1709 mutex_lock(&wl->mutex); 1716 mutex_lock(&wl->mutex);
1710 1717
1711 if (unlikely(wl->state == WL1271_STATE_OFF)) 1718 if (unlikely(wl->state == WL1271_STATE_OFF)) {
1719 ret = -EAGAIN;
1712 goto out; 1720 goto out;
1721 }
1713 1722
1714 ret = wl1271_ps_elp_wakeup(wl, false); 1723 ret = wl1271_ps_elp_wakeup(wl, false);
1715 if (ret < 0) 1724 if (ret < 0)
@@ -1760,6 +1769,9 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
1760 1769
1761 mutex_lock(&wl->mutex); 1770 mutex_lock(&wl->mutex);
1762 1771
1772 if (unlikely(wl->state == WL1271_STATE_OFF))
1773 goto out;
1774
1763 ret = wl1271_ps_elp_wakeup(wl, false); 1775 ret = wl1271_ps_elp_wakeup(wl, false);
1764 if (ret < 0) 1776 if (ret < 0)
1765 goto out; 1777 goto out;
@@ -2040,6 +2052,11 @@ static int wl1271_op_conf_tx(struct ieee80211_hw *hw, u16 queue,
2040 2052
2041 wl1271_debug(DEBUG_MAC80211, "mac80211 conf tx %d", queue); 2053 wl1271_debug(DEBUG_MAC80211, "mac80211 conf tx %d", queue);
2042 2054
2055 if (unlikely(wl->state == WL1271_STATE_OFF)) {
2056 ret = -EAGAIN;
2057 goto out;
2058 }
2059
2043 ret = wl1271_ps_elp_wakeup(wl, false); 2060 ret = wl1271_ps_elp_wakeup(wl, false);
2044 if (ret < 0) 2061 if (ret < 0)
2045 goto out; 2062 goto out;
@@ -2083,6 +2100,9 @@ static u64 wl1271_op_get_tsf(struct ieee80211_hw *hw)
2083 2100
2084 mutex_lock(&wl->mutex); 2101 mutex_lock(&wl->mutex);
2085 2102
2103 if (unlikely(wl->state == WL1271_STATE_OFF))
2104 goto out;
2105
2086 ret = wl1271_ps_elp_wakeup(wl, false); 2106 ret = wl1271_ps_elp_wakeup(wl, false);
2087 if (ret < 0) 2107 if (ret < 0)
2088 goto out; 2108 goto out;