linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mt76: mt76s: fix NULL pointer dereference in mt76s_process_tx_queue
@ 2020-12-08  9:18 Lorenzo Bianconi
  2020-12-17 16:36 ` Kalle Valo
  2020-12-20 12:05 ` Kalle Valo
  0 siblings, 2 replies; 7+ messages in thread
From: Lorenzo Bianconi @ 2020-12-08  9:18 UTC (permalink / raw)
  To: nbd; +Cc: linux-wireless, lorenzo.bianconi

Fix a possible NULL pointer dereference in mt76s_process_tx_queue that
can occur if status thread runs before allocating tx queues

Fixes: 6a618acb7e62 ("mt76: sdio: convert {status/net}_work to mt76_worker")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/sdio.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c
index 7cd995118257..0b6facb17ff7 100644
--- a/drivers/net/wireless/mediatek/mt76/sdio.c
+++ b/drivers/net/wireless/mediatek/mt76/sdio.c
@@ -157,10 +157,14 @@ static void mt76s_net_worker(struct mt76_worker *w)
 
 static int mt76s_process_tx_queue(struct mt76_dev *dev, struct mt76_queue *q)
 {
-	bool mcu = q == dev->q_mcu[MT_MCUQ_WM];
 	struct mt76_queue_entry entry;
 	int nframes = 0;
+	bool mcu;
 
+	if (!q)
+		return 0;
+
+	mcu = q == dev->q_mcu[MT_MCUQ_WM];
 	while (q->queued > 0) {
 		if (!q->entry[q->tail].done)
 			break;
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-12-20 12:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-08  9:18 [PATCH] mt76: mt76s: fix NULL pointer dereference in mt76s_process_tx_queue Lorenzo Bianconi
2020-12-17 16:36 ` Kalle Valo
2020-12-17 17:11   ` Lorenzo Bianconi
2020-12-17 17:20     ` Felix Fietkau
2020-12-17 17:44       ` Kalle Valo
2020-12-17 17:59         ` Lorenzo Bianconi
2020-12-20 12:05 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).