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