wifi: rtl8xxxu: Fix skb misuse in TX queue selection
PATCH v2 1/1 wifi: rtl8xxxu: Fix skb misuse in TX queue selection
rtl8xxxu_queue_select() selects the wrong TX queues because it's reading memory from the wrong address. It expects to find ieee80211_hdr at skb->data, but that's not the case after skb_push(). Move the call to rtl8xxxu_queue_select() before the call to skb_push().
---
v2:
Add Fixes tag.
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +2 -1
@@ -5177,6 +5177,8 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw,if (control && control->sta) sta = control->sta; + queue =rtl8xxxu_queue_select (hw, skb); + tx_desc =skb_push (skb, tx_desc_size);memset (tx_desc,0 , tx_desc_size);
@@ -5189,7 +5191,6 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw, is_broadcast_ether_addr(ieee80211_get_DA(hdr))) tx_desc->txdw0 |= TXDESC_BROADMULTICAST; - queue =rtl8xxxu_queue_select (hw, skb); tx_desc->txdw1 =cpu_to_le32 (queue <<TXDESC_QUEUE_SHIFT );if (tx_info->control.hw_key) {
Signature · 1 line
2.36.1
Quoted 7 lines · Bitterblue Smith
rtl8xxxu_queue_select()selects the wrong TX queues because it's reading memory from the wrong address. It expects to findieee80211_hdratskb->data, but that's not the case afterskb_push(). Move the call tortl8xxxu_queue_select()before the call toskb_push().Fixes 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)")Signed-off-by Bitterblue Smith <[email protected]>
Patch applied to wireless-next.git, thanks.
edd5747aa12e wifi: rtl8xxxu: Fix skb misuse in TX queue selection
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Jes Sorensen
maintainerQuoted 5 lines · Bitterblue Smith
rtl8xxxu_queue_select()selects the wrong TX queues because it's reading memory from the wrong address. It expects to findieee80211_hdratskb->data, but that's not the case afterskb_push(). Move the call tortl8xxxu_queue_select()before the call toskb_push().
Quoted 8 lines
Fixes 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)")Signed-off-by Bitterblue Smith <[email protected]>---
v2:
Add Fixes tag.--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Nice catch!
Quoted 14 lines
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +2
-0@@ -5177,6 +5177,8 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw,if (control && control->sta) sta = control->sta; + queue =rtl8xxxu_queue_select (hw, skb); + tx_desc =skb_push (skb, tx_desc_size);memset (tx_desc,0 , tx_desc_size);
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c static void rtl8xxxu_tx(struct ieee80211_hw *hw, · line 5194
Quoted 5 lines
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +0
-1@@ -5189,7 +5191,6 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw, is_broadcast_ether_addr(ieee80211_get_DA(hdr))) tx_desc->txdw0 |= TXDESC_BROADMULTICAST; - queue =rtl8xxxu_queue_select (hw, skb); tx_desc->txdw1 =cpu_to_le32 (queue <<TXDESC_QUEUE_SHIFT );
This could actually be made more resilient from someone moving the code around by passing in 'hdr' instead of relying on using skb->data in rtl8xxxu_queue_select(). We could also get rid of the hw argument to that function since it isn't used.
Cheers,
Jes
Quoted 1 line · Jes Sorensen
On 8/31/22 12:12, Bitterblue Smith wrote:
[...]
Quoted 25 lines
Quoted 14 lines
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +2
-0@@ -5177,6 +5177,8 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw,if (control && control->sta) sta = control->sta; + queue =rtl8xxxu_queue_select (hw, skb); + tx_desc =skb_push (skb, tx_desc_size);memset (tx_desc,0 , tx_desc_size);drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c static void rtl8xxxu_tx(struct ieee80211_hw *hw, · line 5194
Quoted 5 lines
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +0
-1@@ -5189,7 +5191,6 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw, is_broadcast_ether_addr(ieee80211_get_DA(hdr))) tx_desc->txdw0 |= TXDESC_BROADMULTICAST; - queue =rtl8xxxu_queue_select (hw, skb); tx_desc->txdw1 =cpu_to_le32 (queue <<TXDESC_QUEUE_SHIFT );This could actually be made more resilient from someone moving the code around by passing in 'hdr' instead of relying on using
skb->datainrtl8xxxu_queue_select(). We could also get rid of the hw argument to that function since it isn't used.
Quoted 3 lines
Cheers,
Jes
Good ideas! I'll do that when I'm done fiddling with the RTL8188FU.
Jes Sorensen
maintainerQuoted 28 lines · Bitterblue Smith
Quoted 1 line · Jes Sorensen
On 8/31/22 12:12, Bitterblue Smith wrote:
[...]
Quoted 25 lines
Quoted 14 lines
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +2
-0@@ -5177,6 +5177,8 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw,if (control && control->sta) sta = control->sta; + queue =rtl8xxxu_queue_select (hw, skb); + tx_desc =skb_push (skb, tx_desc_size);memset (tx_desc,0 , tx_desc_size);drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c static void rtl8xxxu_tx(struct ieee80211_hw *hw, · line 5194
Quoted 5 lines
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +0
-1@@ -5189,7 +5191,6 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw, is_broadcast_ether_addr(ieee80211_get_DA(hdr))) tx_desc->txdw0 |= TXDESC_BROADMULTICAST; - queue =rtl8xxxu_queue_select (hw, skb); tx_desc->txdw1 =cpu_to_le32 (queue <<TXDESC_QUEUE_SHIFT );This could actually be made more resilient from someone moving the code around by passing in 'hdr' instead of relying on using
skb->datainrtl8xxxu_queue_select(). We could also get rid of the hw argument to that function since it isn't used.
Quoted 5 lines
Quoted 3 lines
Cheers,
JesGood ideas! I'll do that when I'm done fiddling with the RTL8188FU.
Sounds good!
Thanks,
Jes