aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/main.c
diff options
context:
space:
mode:
authorSenthil Balasubramanian <senthilkumar@atheros.com>2008-11-13 07:31:08 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-11-25 16:41:31 -0500
commitdb93e7b5bf9dea9175d5b213f9557758c56abbfc (patch)
tree31381e563681f4ac8a70d3a77b0134d829724dc3 /drivers/net/wireless/ath9k/main.c
parent306efdd109f086b19d849f1ec0f9104c9fdb3444 (diff)
ath9k: Race condition in accessing TX and RX buffers.
Race condition causes RX buffers to be accessed even before it is initialized. The RX and TX buffers are initialized immediately after the hardware is registered with mac80211. The mac80211 start callback is ready to be fired once the device is registered for a case when the wpa_supplicant is also running at the same time. The same race condition is also possible for RKFILL registration as RFKILL init happens after the device registration with mac80211 and it is possible that rfkill_register would be called even before it is initialized. Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/main.c')
-rw-r--r--drivers/net/wireless/ath9k/main.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 1ebf60627f77..c928db9dc0f0 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -912,14 +912,14 @@ static int ath_attach(u16 devid, struct ath_softc *sc)
912 hw->wiphy->bands[IEEE80211_BAND_5GHZ] = 912 hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
913 &sc->sbands[IEEE80211_BAND_5GHZ]; 913 &sc->sbands[IEEE80211_BAND_5GHZ];
914 914
915 error = ieee80211_register_hw(hw); 915 /* initialize tx/rx engine */
916 if (error != 0) { 916 error = ath_tx_init(sc, ATH_TXBUF);
917 ath_rate_control_unregister(); 917 if (error != 0)
918 goto bad; 918 goto detach;
919 }
920 919
921 /* Initialize LED control */ 920 error = ath_rx_init(sc, ATH_RXBUF);
922 ath_init_leds(sc); 921 if (error != 0)
922 goto detach;
923 923
924#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) 924#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
925 /* Initialze h/w Rfkill */ 925 /* Initialze h/w Rfkill */
@@ -931,15 +931,14 @@ static int ath_attach(u16 devid, struct ath_softc *sc)
931 goto detach; 931 goto detach;
932#endif 932#endif
933 933
934 /* initialize tx/rx engine */ 934 error = ieee80211_register_hw(hw);
935 935 if (error != 0) {
936 error = ath_tx_init(sc, ATH_TXBUF); 936 ath_rate_control_unregister();
937 if (error != 0) 937 goto bad;
938 goto detach; 938 }
939 939
940 error = ath_rx_init(sc, ATH_RXBUF); 940 /* Initialize LED control */
941 if (error != 0) 941 ath_init_leds(sc);
942 goto detach;
943 942
944 return 0; 943 return 0;
945detach: 944detach: