[PATCH] mt76x2: fix possible NULL pointer dereferencing in mt76x2_tx()

Subsystems: mediatek mt76 wireless lan driver, the rest

STALE3059d

3 messages, 3 authors, 2018-03-27 · open the first message on its own page

[PATCH] mt76x2: fix possible NULL pointer dereferencing in mt76x2_tx()

From: Lorenzo Bianconi <hidden>
Date: 2018-03-17 11:29:35

Fix a theoretical NULL pointer dereferencing in mt76x2_tx routine that
can occurs for injected frames in a monitor vif since vif pointer could
be NULL for that interfaces

Fixes: 23405236460b ("mt76: fix transmission of encrypted mgmt frames")
Signed-off-by: Lorenzo Bianconi <redacted>
---
 drivers/net/wireless/mediatek/mt76/mt76x2_tx.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_tx.c b/drivers/net/wireless/mediatek/mt76/mt76x2_tx.c
index 534e4bf9a34c..e46eafc4c436 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_tx.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_tx.c
@@ -36,9 +36,12 @@ void mt76x2_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
 
 		msta = (struct mt76x2_sta *) control->sta->drv_priv;
 		wcid = &msta->wcid;
+		/* sw encrypted frames */
+		if (!info->control.hw_key && wcid->hw_key_idx != -1)
+			control->sta = NULL;
 	}
 
-	if (vif || (!info->control.hw_key && wcid->hw_key_idx != -1)) {
+	if (vif && !control->sta) {
 		struct mt76x2_vif *mvif;
 
 		mvif = (struct mt76x2_vif *) vif->drv_priv;
-- 
2.16.2

Re: [PATCH] mt76x2: fix possible NULL pointer dereferencing in mt76x2_tx()

From: Felix Fietkau <nbd@nbd.name>
Date: 2018-03-17 21:03:35

On 2018-03-17 12:29, Lorenzo Bianconi wrote:
Fix a theoretical NULL pointer dereferencing in mt76x2_tx routine that
can occurs for injected frames in a monitor vif since vif pointer could
be NULL for that interfaces

Fixes: 23405236460b ("mt76: fix transmission of encrypted mgmt frames")
Signed-off-by: Lorenzo Bianconi <redacted>
Acked-by: Felix Fietkau <nbd@nbd.name>

Re: mt76x2: fix possible NULL pointer dereferencing in mt76x2_tx()

From: Kalle Valo <hidden>
Date: 2018-03-27 09:11:46

Lorenzo Bianconi [off-list ref] wrote:
Fix a theoretical NULL pointer dereferencing in mt76x2_tx routine that
can occurs for injected frames in a monitor vif since vif pointer could
be NULL for that interfaces

Fixes: 23405236460b ("mt76: fix transmission of encrypted mgmt frames")
Signed-off-by: Lorenzo Bianconi <redacted>
Acked-by: Felix Fietkau <nbd@nbd.name>
Patch applied to wireless-drivers-next.git, thanks.

6958b027435a mt76x2: fix possible NULL pointer dereferencing in mt76x2_tx()

-- 
https://patchwork.kernel.org/patch/10290771/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help