[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6c02d2b0-1d32-4667-88c8-113165e184c0@intel.com>
Date: Tue, 3 Dec 2024 16:23:11 -0800
From: Jacob Keller <jacob.e.keller@...el.com>
To: Nikita Yushchenko <nikita.yoush@...entembedded.com>, Yoshihiro Shimoda
<yoshihiro.shimoda.uh@...esas.com>, Andrew Lunn <andrew@...n.ch>, "David S.
Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, "Jakub
Kicinski" <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, "Geert
Uytterhoeven" <geert+renesas@...der.be>
CC: <netdev@...r.kernel.org>, <linux-renesas-soc@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, Michael Dege <michael.dege@...esas.com>,
Christian Mardmoeller <christian.mardmoeller@...esas.com>, Dennis Ostermann
<dennis.ostermann@...esas.com>
Subject: Re: [PATCH 2/5] net: renesas: rswitch: fix leaked pointer on error
path
On 12/2/2024 5:49 AM, Nikita Yushchenko wrote:
> If error path is taken while filling descriptor for a frame, skb
> pointer is left in the entry. Later, on the ring entry reuse, the
> same entry could be used as a part of a multi-descriptor frame,
> and skb for that new frame could be stored in a different entry.
>
> Then, the stale pointer will reach the completion routine, and passed
> to the release operation.
>
> Fix that by clearing the saved skb pointer at the error path.
>
> Fixes: d2c96b9d5f83 ("net: rswitch: Add jumbo frames handling for TX")
> Signed-off-by: Nikita Yushchenko <nikita.yoush@...entembedded.com>
> ---
> drivers/net/ethernet/renesas/rswitch.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
> index 32b32aa7e01f..3ad5858d3cdd 100644
> --- a/drivers/net/ethernet/renesas/rswitch.c
> +++ b/drivers/net/ethernet/renesas/rswitch.c
> @@ -1703,6 +1703,7 @@ static netdev_tx_t rswitch_start_xmit(struct sk_buff *skb, struct net_device *nd
> return ret;
>
> err_unmap:
> + gq->skbs[(gq->cur + nr_desc - 1) % gq->ring_size] = NULL;
> dma_unmap_single(ndev->dev.parent, dma_addr_orig, skb->len, DMA_TO_DEVICE);
>
Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>
> err_kfree:
Powered by blists - more mailing lists