diff mbox

[v2] mt76x2: init: disable all pending tasklets during device removal

Message ID 612e527f5358f4d7d465f21fc72b5b649dce5f40.1516697336.git.lorenzo.bianconi@redhat.com (mailing list archive)
State Accepted
Commit ba9797b2a7a5c1dfaa1cc189bbb9493a6d8f03cf
Delegated to: Kalle Valo
Headers show

Commit Message

Lorenzo Bianconi Jan. 23, 2018, 9:03 a.m. UTC
There is a possible race in mt76x2_stop_hardware() since pre_tbtt and
dfs tasklets could run during driver cleanup. Fix it disabling all
pending tasklets during device removal

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
Changes since v1:
- add proper commit message
- squash patch 1/2 and 2/2
---
 drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Felix Fietkau Jan. 23, 2018, 10:39 a.m. UTC | #1
On 2018-01-23 10:03, Lorenzo Bianconi wrote:
> There is a possible race in mt76x2_stop_hardware() since pre_tbtt and
> dfs tasklets could run during driver cleanup. Fix it disabling all
> pending tasklets during device removal
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Felix Fietkau <nbd@nbd.name>
Kalle Valo Jan. 24, 2018, 3:17 p.m. UTC | #2
Lorenzo Bianconi <lorenzo.bianconi@redhat.com> wrote:

> There is a possible race in mt76x2_stop_hardware() since pre_tbtt and
> dfs tasklets could run during driver cleanup. Fix it disabling all
> pending tasklets during device removal
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> Acked-by: Felix Fietkau <nbd@nbd.name>

Patch applied to wireless-drivers-next.git, thanks.

ba9797b2a7a5 mt76x2: init: disable all pending tasklets during device removal
diff mbox

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
index 9f20a308ff76..7b4851481dd6 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
@@ -614,6 +614,8 @@  void mt76x2_stop_hardware(struct mt76x2_dev *dev)
 
 void mt76x2_cleanup(struct mt76x2_dev *dev)
 {
+	tasklet_disable(&dev->dfs_pd.dfs_tasklet);
+	tasklet_disable(&dev->pre_tbtt_tasklet);
 	mt76x2_stop_hardware(dev);
 	mt76x2_dma_cleanup(dev);
 	mt76x2_mcu_cleanup(dev);