aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2008-08-03 18:58:36 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-04 15:09:12 -0400
commit6041e2a08c50e3fcaf1e56422bfafda62c597cea (patch)
tree515d1d222f9323232da46aa024cb38e707481a1f
parentd06193f311102b2c990ec5f66b470ea49ecc73a4 (diff)
p54: Fix potential concurrent access to private data
Experience with the rtl8187 driver has shown that mac80211 can make calls to the config callback routine in rapid succession. This patch creates a mutex that protects the private data in several of the routines called by mac80211. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/p54/p54.h1
-rw-r--r--drivers/net/wireless/p54/p54common.c6
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/wireless/p54/p54.h b/drivers/net/wireless/p54/p54.h
index c6f27b9022f9..cac9a515b82d 100644
--- a/drivers/net/wireless/p54/p54.h
+++ b/drivers/net/wireless/p54/p54.h
@@ -52,6 +52,7 @@ struct p54_common {
52 int (*open)(struct ieee80211_hw *dev); 52 int (*open)(struct ieee80211_hw *dev);
53 void (*stop)(struct ieee80211_hw *dev); 53 void (*stop)(struct ieee80211_hw *dev);
54 int mode; 54 int mode;
55 struct mutex conf_mutex;
55 u8 mac_addr[ETH_ALEN]; 56 u8 mac_addr[ETH_ALEN];
56 u8 bssid[ETH_ALEN]; 57 u8 bssid[ETH_ALEN];
57 struct pda_iq_autocal_entry *iq_autocal; 58 struct pda_iq_autocal_entry *iq_autocal;
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index ffaf7a6b6810..4da89ea9b561 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -886,9 +886,12 @@ static void p54_remove_interface(struct ieee80211_hw *dev,
886static int p54_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) 886static int p54_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
887{ 887{
888 int ret; 888 int ret;
889 struct p54_common *priv = dev->priv;
889 890
891 mutex_lock(&priv->conf_mutex);
890 ret = p54_set_freq(dev, cpu_to_le16(conf->channel->center_freq)); 892 ret = p54_set_freq(dev, cpu_to_le16(conf->channel->center_freq));
891 p54_set_vdcf(dev); 893 p54_set_vdcf(dev);
894 mutex_unlock(&priv->conf_mutex);
892 return ret; 895 return ret;
893} 896}
894 897
@@ -898,10 +901,12 @@ static int p54_config_interface(struct ieee80211_hw *dev,
898{ 901{
899 struct p54_common *priv = dev->priv; 902 struct p54_common *priv = dev->priv;
900 903
904 mutex_lock(&priv->conf_mutex);
901 p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 0, 1, 0, 0xF642); 905 p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 0, 1, 0, 0xF642);
902 p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 2, 0, 0, 0); 906 p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 2, 0, 0, 0);
903 p54_set_leds(dev, 1, !is_multicast_ether_addr(conf->bssid), 0); 907 p54_set_leds(dev, 1, !is_multicast_ether_addr(conf->bssid), 0);
904 memcpy(priv->bssid, conf->bssid, ETH_ALEN); 908 memcpy(priv->bssid, conf->bssid, ETH_ALEN);
909 mutex_unlock(&priv->conf_mutex);
905 return 0; 910 return 0;
906} 911}
907 912
@@ -1009,6 +1014,7 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len)
1009 } 1014 }
1010 1015
1011 p54_init_vdcf(dev); 1016 p54_init_vdcf(dev);
1017 mutex_init(&priv->conf_mutex);
1012 1018
1013 return dev; 1019 return dev;
1014} 1020}