[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3f3957dd-5aae-ca0d-d487-fe062d989980@hauke-m.de>
Date: Sat, 5 Mar 2022 16:41:00 +0100
From: Hauke Mehrtens <hauke@...ke-m.de>
To: Aleksander Jan Bajkowski <olek2@...pl>, davem@...emloft.net,
kuba@...nel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Eric Dumazet <eric.dumazet@...il.com>
Subject: Re: [PATCH net] net: lantiq_xrx200: fix use after free bug
On 3/5/22 12:20, Aleksander Jan Bajkowski wrote:
> 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@...il.com>
> Signed-off-by: Aleksander Jan Bajkowski <olek2@...pl>
Acked-by: Hauke Mehrtens <hauke@...ke-m.de>
> ---
> drivers/net/ethernet/lantiq_xrx200.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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;
Powered by blists - more mailing lists