Skip to contentSkip to conversation

Fix two possible NULL pointer dereferencing issues

PATCH In review Lorenzo Bianconi 4 participants 13 messages Dec 14, 2017 – Jan 23, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Fix two possible NULL pointer dereferencing issues

Lorenzo Bianconi (2):
mt76: fix possible NULL pointer dereferencing in mt76x2_ampdu_action()
mt76: fix possible NULL pointer dereferencing in

    mt76x2_mac_write_txwi()
 drivers/net/wireless/mediatek/mt76/mt76x2_mac.c  | 2 +-
 drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.13.6
#1 lore raw

PATCH 1/2 mt76: fix possible NULL pointer dereferencing in mt76x2_ampdu_action()

Initialize mt76_txq pointer after ieee80211_txq pointer check. Remove space after the pointer cast

Fixes 7bc04215a66b ("mt76: add driver code for MT76x2e")
---
 drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt76x2_main.c +3 -1
index 2cef48edb275..33469e32567b 100644
@@ -450,13 +450,15 @@ mt76x2_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	struct mt76x2_dev *dev = hw->priv;
 	struct mt76x2_sta *msta = (struct mt76x2_sta *) sta->drv_priv;
 	struct ieee80211_txq *txq = sta->txq[params->tid];
-	struct mt76_txq *mtxq = (struct mt76_txq *) txq->drv_priv;
 	u16 tid = params->tid;
 	u16 *ssn = &params->ssn;
+	struct mt76_txq *mtxq;
 
 	if (!txq)
 		return -EINVAL;
 
+	mtxq = (struct mt76_txq *)txq->drv_priv;
+
 	switch (action) {
 	case IEEE80211_AMPDU_RX_START:
 		mt76_set(dev, MT_WCID_ADDR(msta->wcid.idx) + 4, BIT(16 + tid));
Signature · 1 line
2.13.6
#12 lore raw

PATCH 2/2 mt76: fix possible NULL pointer dereferencing in mt76x2_mac_write_txwi()

In reply to Lorenzo Bianconi

Verify wcid is not NULL before dereferencing the pointer to initialize txwi rate/power info

Fixes 7bc04215a66b ("mt76: add driver code for MT76x2e")
---
 drivers/net/wireless/mediatek/mt76/mt76x2_mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c +1 -1
index 39fc1d7b65ce..a1f695e9b51c 100644
@@ -185,7 +185,7 @@ void mt76x2_mac_write_txwi(struct mt76x2_dev *dev, struct mt76x2_txwi *txwi,
 	txwi->pktid = 1;
 
 	spin_lock_bh(&dev->mt76.lock);
-	if (rate->idx < 0 || !rate->count) {
+	if (wcid && (rate->idx < 0 || !rate->count)) {
 		txwi->rate = wcid->tx_rate;
 		max_txpwr_adj = wcid->max_txpwr_adj;
 		nss = wcid->tx_rate_nss;
Signature · 1 line
2.13.6
#2 lore raw

Re: [1/2] mt76: fix possible NULL pointer dereferencing in mt76x2_ampdu_action()

In reply to Lorenzo Bianconi
Quoted 5 lines · Lorenzo Bianconi

Initialize mt76_txq pointer after ieee80211_txq pointer check. Remove space after the pointer cast

Fixes 7bc04215a66b ("mt76: add driver code for MT76x2e")

What am I supposed to do with this and patch 2? Drop?

Signature · 3 lines
https://patchwork.kernel.org/patch/10111937/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#4 lore raw

Re: [1/2] mt76: fix possible NULL pointer dereferencing in mt76x2_ampdu_action()

In reply to a message not in the archive
Quoted 9 lines
Quoted 5 lines · Lorenzo Bianconi

Initialize mt76_txq pointer after ieee80211_txq pointer check. Remove space after the pointer cast

Fixes 7bc04215a66b ("mt76: add driver code for MT76x2e")

What am I supposed to do with this and patch 2? Drop?

Hi Kalle,

What do you mean? Why drop?

Regards,
Lorenzo

Quoted 6 lines

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

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

#5 lore raw

Re: [1/2] mt76: fix possible NULL pointer dereferencing in mt76x2_ampdu_action()

Quoted 11 lines · Lorenzo Bianconi
Quoted 9 lines
Quoted 5 lines · Lorenzo Bianconi

Initialize mt76_txq pointer after ieee80211_txq pointer check. Remove space after the pointer cast

Fixes 7bc04215a66b ("mt76: add driver code for MT76x2e")

What am I supposed to do with this and patch 2? Drop?

What do you mean? Why drop?

I didn't see Felix's ack, at least not on patchwork.

Signature · 1 line
Kalle Valo
#6 lore raw

Re: [1/2] mt76: fix possible NULL pointer dereferencing in mt76x2_ampdu_action()

Quoted 10 lines
Quoted 8 lines · Lorenzo Bianconi
Quoted 8 lines
Quoted 5 lines · Lorenzo Bianconi

Initialize mt76_txq pointer after ieee80211_txq pointer check. Remove space after the pointer cast

Fixes 7bc04215a66b ("mt76: add driver code for MT76x2e")
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

What am I supposed to do with this and patch 2? Drop?

What do you mean? Why drop?

I didn't see Felix's ack, at least not on patchwork.

--
Kalle Valo

They should be fine since he merged them in mt76 github repo:
- https://github.com/openwrt/mt76/commit/ca5ca8c779932e7cab3224053377b29f139904b9
- https://github.com/openwrt/mt76/commit/2d4b8f57cc5e3101d45785ae9a9f1eb6fc229de9

Anyway we can wait for him, up to you.
Regards,

Lorenzo

maintainer
#7 lore raw

Re: [1/2] mt76: fix possible NULL pointer dereferencing in mt76x2_ampdu_action()

In reply to Kalle Valo
Quoted 7 lines · Kalle Valo
Quoted 5 lines · Lorenzo Bianconi
Quoted 5 lines
Quoted 3 lines · Lorenzo Bianconi

Initialize mt76_txq pointer after ieee80211_txq pointer check. Remove space after the pointer cast

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Fixes 7bc04215a66b ("mt76: add driver code for MT76x2e")

What am I supposed to do with this and patch 2? Drop?

What do you mean? Why drop?

I didn't see Felix's ack, at least not on patchwork.

I sent my ack (for both patches) as a reply to 0/2 These patches should go in.

- Felix

#11 lore raw

Re: [1/2] mt76: fix possible NULL pointer dereferencing in mt76x2_ampdu_action()

In reply to Lorenzo Bianconi
Quoted 5 lines · Lorenzo Bianconi

Initialize mt76_txq pointer after ieee80211_txq pointer check. Remove space after the pointer cast

Fixes 7bc04215a66b ("mt76: add driver code for MT76x2e")

2 patches applied to wireless-drivers-next.git, thanks.

99ac5327e902 mt76: fix possible NULL pointer dereferencing in mt76x2_ampdu_action() 98051872fd25 mt76: fix possible NULL pointer dereferencing in mt76x2_mac_write_txwi()

Signature · 3 lines
https://patchwork.kernel.org/patch/10111937/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#8 lore raw

Re: [1/2] mt76: fix possible NULL pointer dereferencing in mt76x2_ampdu_action()

In reply to Felix Fietkau
Quoted 11 lines · Felix Fietkau
Quoted 10 lines · Kalle Valo
Quoted 8 lines · Lorenzo Bianconi
Quoted 8 lines
Quoted 5 lines · Lorenzo Bianconi

Initialize mt76_txq pointer after ieee80211_txq pointer check. Remove space after the pointer cast

Fixes 7bc04215a66b ("mt76: add driver code for MT76x2e")
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

What am I supposed to do with this and patch 2? Drop?

What do you mean? Why drop?

I didn't see Felix's ack, at least not on patchwork.

I sent my ack (for both patches) as a reply to 0/2

Ah. patchwork is annoying as it doesn't show the cover letter at all so I missed that.

Quoted 1 line

These patches should go in.

These two are applied now.

Signature · 1 line
Kalle Valo
#9 lore raw

Re: [1/2] mt76: fix possible NULL pointer dereferencing in mt76x2_ampdu_action()

On Mittwoch, 17. Januar 2018 16:50:23 CET Kalle Valo wrote:
[...]

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I didn't see Felix's ack, at least not on patchwork.

I sent my ack (for both patches) as a reply to 0/2

Ah. patchwork is annoying as it doesn't show the cover letter at all so I missed that.

Newer version at least can track the series and their cover letters. This is not completely what you want but at least there is hope. Here is an example:
https://patchwork.open-mesh.org/cover/17240/ (you can use "Related" to see all the patches in the series).

Kind regards,
Sven

#10 lore raw

Re: [1/2] mt76: fix possible NULL pointer dereferencing in mt76x2_ampdu_action()

Quoted 6 lines · Sven Eckelmann

On Mittwoch, 17. Januar 2018 16:50:23 CET Kalle Valo wrote:
[...]

Quoted 4 lines
Quoted 3 lines
Quoted 1 line

I didn't see Felix's ack, at least not on patchwork.

I sent my ack (for both patches) as a reply to 0/2

Quoted 7 lines
Quoted 2 lines

Ah. patchwork is annoying as it doesn't show the cover letter at all so I missed that.

Newer version at least can track the series and their cover letters. This is not completely what you want but at least there is hope. Here is an example:
https://patchwork.open-mesh.org/cover/17240/ (you can use "Related" to see all the patches in the series).

Nice, looking forward to see that version in patchwork.kernel.org. My ultimate goal is that I could doo all my maintenance work via my patchwork script and not touch my email client at all. That's getting closer.

Signature · 1 line
Kalle Valo