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>

authored by Larry Finger and committed by John W. Linville 6041e2a0 d06193f3

+7
+1
drivers/net/wireless/p54/p54.h
··· 52 int (*open)(struct ieee80211_hw *dev); 53 void (*stop)(struct ieee80211_hw *dev); 54 int mode; 55 u8 mac_addr[ETH_ALEN]; 56 u8 bssid[ETH_ALEN]; 57 struct pda_iq_autocal_entry *iq_autocal;
··· 52 int (*open)(struct ieee80211_hw *dev); 53 void (*stop)(struct ieee80211_hw *dev); 54 int mode; 55 + struct mutex conf_mutex; 56 u8 mac_addr[ETH_ALEN]; 57 u8 bssid[ETH_ALEN]; 58 struct pda_iq_autocal_entry *iq_autocal;
+6
drivers/net/wireless/p54/p54common.c
··· 886 static int p54_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) 887 { 888 int ret; 889 890 ret = p54_set_freq(dev, cpu_to_le16(conf->channel->center_freq)); 891 p54_set_vdcf(dev); 892 return ret; 893 } 894 ··· 901 { 902 struct p54_common *priv = dev->priv; 903 904 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, 2, 0, 0, 0); 906 p54_set_leds(dev, 1, !is_multicast_ether_addr(conf->bssid), 0); 907 memcpy(priv->bssid, conf->bssid, ETH_ALEN); 908 return 0; 909 } 910 ··· 1014 } 1015 1016 p54_init_vdcf(dev); 1017 1018 return dev; 1019 }
··· 886 static int p54_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) 887 { 888 int ret; 889 + struct p54_common *priv = dev->priv; 890 891 + mutex_lock(&priv->conf_mutex); 892 ret = p54_set_freq(dev, cpu_to_le16(conf->channel->center_freq)); 893 p54_set_vdcf(dev); 894 + mutex_unlock(&priv->conf_mutex); 895 return ret; 896 } 897 ··· 898 { 899 struct p54_common *priv = dev->priv; 900 901 + mutex_lock(&priv->conf_mutex); 902 p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 0, 1, 0, 0xF642); 903 p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 2, 0, 0, 0); 904 p54_set_leds(dev, 1, !is_multicast_ether_addr(conf->bssid), 0); 905 memcpy(priv->bssid, conf->bssid, ETH_ALEN); 906 + mutex_unlock(&priv->conf_mutex); 907 return 0; 908 } 909 ··· 1009 } 1010 1011 p54_init_vdcf(dev); 1012 + mutex_init(&priv->conf_mutex); 1013 1014 return dev; 1015 }