From: Simon Horman <horms@kernel.org>
To: Wang Hai <wanghai38@huawei.com>
Cc: sammy@sammy.net, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, zhangxiaoxu5@huawei.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net/sun3_82586: fix potential memory leak in sun3_82586_send_packet()
Date: Wed, 16 Oct 2024 14:49:30 +0100 [thread overview]
Message-ID: <20241016134930.GF2162@kernel.org> (raw)
In-Reply-To: <20241015144148.7918-1-wanghai38@huawei.com>
On Tue, Oct 15, 2024 at 10:41:48PM +0800, Wang Hai wrote:
> The sun3_82586_send_packet() returns NETDEV_TX_OK without freeing skb
> in case of skb->len being too long, add dev_kfree_skb() to fix it.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Wang Hai <wanghai38@huawei.com>
> ---
> drivers/net/ethernet/i825xx/sun3_82586.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/i825xx/sun3_82586.c b/drivers/net/ethernet/i825xx/sun3_82586.c
> index f2d4669c81cf..58a3d28d938c 100644
> --- a/drivers/net/ethernet/i825xx/sun3_82586.c
> +++ b/drivers/net/ethernet/i825xx/sun3_82586.c
> @@ -1012,6 +1012,7 @@ sun3_82586_send_packet(struct sk_buff *skb, struct net_device *dev)
> if(skb->len > XMIT_BUFF_SIZE)
> {
> printk("%s: Sorry, max. framelength is %d bytes. The length of your frame is %d bytes.\n",dev->name,XMIT_BUFF_SIZE,skb->len);
> + dev_kfree_skb(skb);
> return NETDEV_TX_OK;
> }
Thanks,
I agree that:
* This code-change is correct,
* and in keeping with other code in this function.
* And I agree that this problem goes back to the beginning of git history
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2024-10-16 13:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-15 14:41 [PATCH net] net/sun3_82586: fix potential memory leak in sun3_82586_send_packet() Wang Hai
2024-10-16 13:49 ` Simon Horman [this message]
2024-10-20 14:50 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241016134930.GF2162@kernel.org \
--to=horms@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sammy@sammy.net \
--cc=wanghai38@huawei.com \
--cc=zhangxiaoxu5@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).