diff mbox series

wil6210: use after free in wil_netif_rx_any()

Message ID 20190921060145.GD18726@mwanda (mailing list archive)
State Accepted
Commit 2b481835cf4e7384b80d7762074b32a45b792d99
Delegated to: Kalle Valo
Headers show
Series wil6210: use after free in wil_netif_rx_any() | expand

Commit Message

Dan Carpenter Sept. 21, 2019, 6:01 a.m. UTC
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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/wireless/ath/wil6210/txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kalle Valo Sept. 21, 2019, 6:31 a.m. UTC | #1
Dan Carpenter <dan.carpenter@oracle.com> writes:

> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

As this is a regression starting from v5.4-rc1, I'll queue this to v5.4.
Kalle Valo Sept. 25, 2019, 6:12 a.m. UTC | #2
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Patch applied to wireless-drivers.git, thanks.

2b481835cf4e wil6210: use after free in wil_netif_rx_any()
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
index cb13652491ad..598c1fba9dac 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -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;
 	}