Skip to contentSkip to conversation

wil6210: use after free in wil_netif_rx_any()

PATCH In review Dan Carpenter 2 participants 3 messages Sep 21, 2019 – Sep 25, 2019

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

PATCH 1/1 wil6210: use after free in wil_netif_rx_any()

The debug code dereferences "skb" to print "skb->len" so we have to print the message before we free "skb".

Fixes f99fe49ff372 ("wil6210: add wil_netif_rx() helper function")
---
 drivers/net/wireless/ath/wil6210/txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/wil6210/txrx.c +1 -1
index cb13652491ad..598c1fba9dac 100644
@@ -1012,11 +1012,11 @@ void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev)
 	skb_orphan(skb);
 
 	if (security && (wil->txrx_ops.rx_crypto_check(wil, skb) != 0)) {
+		wil_dbg_txrx(wil, "Rx drop %d bytes\n", skb->len);
 		dev_kfree_skb(skb);
 		ndev->stats.rx_dropped++;
 		stats->rx_replay++;
 		stats->rx_dropped++;
-		wil_dbg_txrx(wil, "Rx drop %d bytes\n", skb->len);
 		return;
 	}
 
Signature · 1 line
2.20.1
#1 lore raw
Quoted 5 lines · Dan Carpenter

The debug code dereferences "skb" to print "skb->len" so we have to print the message before we free "skb".

Fixes f99fe49ff372 ("wil6210: add wil_netif_rx() helper function")

As this is a regression starting from v5.4-rc1, I'll queue this to v5.4.

Signature · 1 line
Kalle Valo
#2 lore raw
In reply to Dan Carpenter
Quoted 5 lines · Dan Carpenter

The debug code dereferences "skb" to print "skb->len" so we have to print the message before we free "skb".

Fixes f99fe49ff372 ("wil6210: add wil_netif_rx() helper function")

Patch applied to wireless-drivers.git, thanks.

2b481835cf4e wil6210: use after free in wil_netif_rx_any()

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

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