diff options
author | Pavel Andrianov <andrianov@ispras.ru> | 2016-06-15 15:34:03 +0400 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2016-06-29 18:46:56 +0300 |
commit | f52b041aed77592862c97726b98d78e8dccd72c9 (patch) | |
tree | 18e3a9e1f0401363f9c70b817965e505f9710d7d /drivers/net/wireless/marvell | |
parent | 6edc119ed3b5e860535d49852f8cc8e5be95538d (diff) | |
download | op-kernel-dev-f52b041aed77592862c97726b98d78e8dccd72c9.zip op-kernel-dev-f52b041aed77592862c97726b98d78e8dccd72c9.tar.gz |
libertas: Add spinlock to avoid race condition
lbs_mac_event_disconnected may free priv->currenttxskb
while lbs_hard_start_xmit accesses to it.
The patch adds a spinlock for mutual exclusion.
Tested on OLPC XO-1 (usb8388) and XO-1.5 (sd8686) with v4.7-rc3.
Confirmed that lbs_mac_event_disconnected is being called on the
station when hostapd on access point is given SIGHUP.
Signed-off-by: Pavel <andrianov@ispras.ru>
Tested-by: James Cameron <quozl@laptop.org>
Acked-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/marvell')
-rw-r--r-- | drivers/net/wireless/marvell/libertas/cmdresp.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/wireless/marvell/libertas/cmdresp.c b/drivers/net/wireless/marvell/libertas/cmdresp.c index c95bf6d..c753e36 100644 --- a/drivers/net/wireless/marvell/libertas/cmdresp.c +++ b/drivers/net/wireless/marvell/libertas/cmdresp.c @@ -27,6 +27,8 @@ void lbs_mac_event_disconnected(struct lbs_private *priv, bool locally_generated) { + unsigned long flags; + if (priv->connect_status != LBS_CONNECTED) return; @@ -46,9 +48,11 @@ void lbs_mac_event_disconnected(struct lbs_private *priv, netif_carrier_off(priv->dev); /* Free Tx and Rx packets */ + spin_lock_irqsave(&priv->driver_lock, flags); kfree_skb(priv->currenttxskb); priv->currenttxskb = NULL; priv->tx_pending_len = 0; + spin_unlock_irqrestore(&priv->driver_lock, flags); priv->connect_status = LBS_DISCONNECTED; |