aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2007-10-28 10:59:58 -0400
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:03:30 -0500
commitc6dfc9a8ec236957eea3a1cf4613e90c45e1475b (patch)
tree148e52e8f3680a7edcbef895106433d7d1997e20 /drivers
parent0c1d379d2ee19b1a20904c3609440c061673f53c (diff)
b43: Dereference of wl->current_dev must be protected by wl->mutex
Put all access to wl->current_dev under protection of the mutex. Signed-off-by: Michael Buesch <mb@bu3sch.de> Cc: Larry Finger <larry.finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/b43/main.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 1c93b4f4bfe3..9568ab17fe71 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2810,18 +2810,25 @@ static int b43_dev_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
2810 struct ieee80211_key_conf *key) 2810 struct ieee80211_key_conf *key)
2811{ 2811{
2812 struct b43_wl *wl = hw_to_b43_wl(hw); 2812 struct b43_wl *wl = hw_to_b43_wl(hw);
2813 struct b43_wldev *dev = wl->current_dev; 2813 struct b43_wldev *dev;
2814 unsigned long flags; 2814 unsigned long flags;
2815 u8 algorithm; 2815 u8 algorithm;
2816 u8 index; 2816 u8 index;
2817 int err = -EINVAL; 2817 int err;
2818 DECLARE_MAC_BUF(mac); 2818 DECLARE_MAC_BUF(mac);
2819 2819
2820 if (modparam_nohwcrypt) 2820 if (modparam_nohwcrypt)
2821 return -ENOSPC; /* User disabled HW-crypto */ 2821 return -ENOSPC; /* User disabled HW-crypto */
2822 2822
2823 if (!dev) 2823 mutex_lock(&wl->mutex);
2824 return -ENODEV; 2824 spin_lock_irqsave(&wl->irq_lock, flags);
2825
2826 dev = wl->current_dev;
2827 err = -ENODEV;
2828 if (!dev || b43_status(dev) < B43_STAT_INITIALIZED)
2829 goto out_unlock;
2830
2831 err = -EINVAL;
2825 switch (key->alg) { 2832 switch (key->alg) {
2826 case ALG_WEP: 2833 case ALG_WEP:
2827 if (key->keylen == 5) 2834 if (key->keylen == 5)
@@ -2837,20 +2844,11 @@ static int b43_dev_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
2837 break; 2844 break;
2838 default: 2845 default:
2839 B43_WARN_ON(1); 2846 B43_WARN_ON(1);
2840 goto out; 2847 goto out_unlock;
2841 } 2848 }
2842
2843 index = (u8) (key->keyidx); 2849 index = (u8) (key->keyidx);
2844 if (index > 3) 2850 if (index > 3)
2845 goto out;
2846
2847 mutex_lock(&wl->mutex);
2848 spin_lock_irqsave(&wl->irq_lock, flags);
2849
2850 if (b43_status(dev) < B43_STAT_INITIALIZED) {
2851 err = -ENODEV;
2852 goto out_unlock; 2851 goto out_unlock;
2853 }
2854 2852
2855 switch (cmd) { 2853 switch (cmd) {
2856 case SET_KEY: 2854 case SET_KEY: