[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89i+LwDrV4km4iymw4yXU+kVMAvhmLUk2x_bmKXD_Bphi5w@mail.gmail.com>
Date: Tue, 15 Oct 2024 09:49:11 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Wang Hai <wanghai38@...wei.com>
Cc: niklas.soderlund@...natech.se, davem@...emloft.net, kuba@...nel.org,
pabeni@...hat.com, andrew@...n.ch, zhangxiaoxu5@...wei.com,
netdev@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] net: ethernet: rtsn: fix potential memory leak in rtsn_start_xmit()
On Mon, Oct 14, 2024 at 4:43 PM Wang Hai <wanghai38@...wei.com> wrote:
>
> The rtsn_start_xmit() returns NETDEV_TX_OK without freeing skb
> in case of skb->len being too long, add dev_kfree_skb_any() to fix it.
>
> Fixes: b0d3969d2b4d ("net: ethernet: rtsn: Add support for Renesas Ethernet-TSN")
> Signed-off-by: Wang Hai <wanghai38@...wei.com>
> ---
> drivers/net/ethernet/renesas/rtsn.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/renesas/rtsn.c b/drivers/net/ethernet/renesas/rtsn.c
> index f9f63c61d792..6b3f7fca8d15 100644
> --- a/drivers/net/ethernet/renesas/rtsn.c
> +++ b/drivers/net/ethernet/renesas/rtsn.c
> @@ -1057,6 +1057,7 @@ static netdev_tx_t rtsn_start_xmit(struct sk_buff *skb, struct net_device *ndev)
> if (skb->len >= TX_DS) {
> priv->stats.tx_dropped++;
> priv->stats.tx_errors++;
> + dev_kfree_skb_any(skb);
> goto out;
> }
>
Note this is dead code for this driver. This condition should never be
hit with checks in upper layers,
because TX_DS is bigger than device max mtu.
Reviewed-by: Eric Dumazet <edumazet@...gle.com>
Powered by blists - more mailing lists