Skip to content

Commit 884a963

Browse files
Rajkumar Manoharanlinvjw
authored andcommitted
ath9k: fix beacon resource related race condition
The beacon tasklet is accesssing the bslot info for beacon generation. Meanwhile the same slot can be freed on interface deletion. Current the remove_interface disables the beacon alert after freeing the slot. This may leads to null pointer access. This patch disables SWBA and kills the beacon tasklet to prevent access to the slot to be freed. After releasing the slot, swba will be enabled again upon the availablity of beaconing interfaces. Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 38852b2 commit 884a963

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

  • drivers/net/wireless/ath/ath9k

‎drivers/net/wireless/ath/ath9k/main.c‎

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,8 +1520,6 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
15201520
struct ath_softc *sc = aphy->sc;
15211521
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
15221522
struct ath_vif *avp = (void *)vif->drv_priv;
1523-
bool bs_valid = false;
1524-
int i;
15251523

15261524
ath_print(common, ATH_DBG_CONFIG, "Detach Interface\n");
15271525

@@ -1535,26 +1533,21 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
15351533
if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) ||
15361534
(sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) ||
15371535
(sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) {
1536+
/* Disable SWBA interrupt */
1537+
sc->sc_ah->imask &= ~ATH9K_INT_SWBA;
15381538
ath9k_ps_wakeup(sc);
1539+
ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask);
15391540
ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
15401541
ath9k_ps_restore(sc);
1542+
tasklet_kill(&sc->bcon_tasklet);
15411543
}
15421544

15431545
ath_beacon_return(sc, avp);
15441546
sc->sc_flags &= ~SC_OP_BEACONS;
15451547

1546-
for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) {
1547-
if (sc->beacon.bslot[i] == vif) {
1548-
printk(KERN_DEBUG "%s: vif had allocated beacon "
1549-
"slot\n", __func__);
1550-
sc->beacon.bslot[i] = NULL;
1551-
sc->beacon.bslot_aphy[i] = NULL;
1552-
} else if (sc->beacon.bslot[i])
1553-
bs_valid = true;
1554-
}
1555-
if (!bs_valid && (sc->sc_ah->imask & ATH9K_INT_SWBA)) {
1556-
/* Disable SWBA interrupt */
1557-
sc->sc_ah->imask &= ~ATH9K_INT_SWBA;
1548+
if (sc->nbcnvifs) {
1549+
/* Re-enable SWBA interrupt */
1550+
sc->sc_ah->imask |= ATH9K_INT_SWBA;
15581551
ath9k_ps_wakeup(sc);
15591552
ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask);
15601553
ath9k_ps_restore(sc);

0 commit comments

Comments
 (0)