summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAleksander Jan Bajkowski <olek2@wp.pl>2022-03-05 12:20:39 +0100
committerDavid S. Miller <davem@davemloft.net>2022-03-07 11:29:35 +0000
commitdd830aed23c6e07cd8e2a163742bf3d63c9add08 (patch)
tree632d939d9251e0464b357b3171f2d7d78f7c3810 /drivers/net
parente0058f0fa80f6e09c4d363779c241c45a3c56b94 (diff)
downloadlinux-stable-dd830aed23c6e07cd8e2a163742bf3d63c9add08.tar.gz
linux-stable-dd830aed23c6e07cd8e2a163742bf3d63c9add08.tar.bz2
linux-stable-dd830aed23c6e07cd8e2a163742bf3d63c9add08.zip
net: lantiq_xrx200: fix use after free bug
The skb->len field is read after the packet is sent to the network stack. In the meantime, skb can be freed. This patch fixes this bug. Fixes: c3e6b2c35b34 ("net: lantiq_xrx200: add ingress SG DMA support") Reported-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/lantiq_xrx200.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
index 41d11137cde0..5712c3e94be8 100644
--- a/drivers/net/ethernet/lantiq_xrx200.c
+++ b/drivers/net/ethernet/lantiq_xrx200.c
@@ -260,9 +260,9 @@ static int xrx200_hw_receive(struct xrx200_chan *ch)
if (ctl & LTQ_DMA_EOP) {
ch->skb_head->protocol = eth_type_trans(ch->skb_head, net_dev);
- netif_receive_skb(ch->skb_head);
net_dev->stats.rx_packets++;
net_dev->stats.rx_bytes += ch->skb_head->len;
+ netif_receive_skb(ch->skb_head);
ch->skb_head = NULL;
ch->skb_tail = NULL;
ret = XRX200_DMA_PACKET_COMPLETE;