lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <75072c5d-9145-492c-b99a-4f47ae88b069@engleder-embedded.com>
Date: Sat, 12 Oct 2024 20:30:28 +0200
From: Gerhard Engleder <gerhard@...leder-embedded.com>
To: Wang Hai <wanghai38@...wei.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
 kristoffer@...sler.com, zhangxiaoxu5@...wei.com, pabeni@...hat.com,
 kuba@...nel.org, edumazet@...gle.com, davem@...emloft.net,
 andreas@...sler.com
Subject: Re: [PATCH v2 net] net: ethernet: aeroflex: fix potential memory leak
 in greth_start_xmit_gbit()

On 12.10.24 13:04, Wang Hai wrote:
> The greth_start_xmit_gbit() returns NETDEV_TX_OK without freeing skb
> in case of skb->len being too long, add dev_kfree_skb() to fix it.
> 
> Fixes: d4c41139df6e ("net: Add Aeroflex Gaisler 10/100/1G Ethernet MAC driver")
> Signed-off-by: Wang Hai <wanghai38@...wei.com>
> ---
> v1->v2: Using dev_kfree_skb() in error handling.
>   drivers/net/ethernet/aeroflex/greth.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c
> index 27af7746d645..adf6f67c5fcb 100644
> --- a/drivers/net/ethernet/aeroflex/greth.c
> +++ b/drivers/net/ethernet/aeroflex/greth.c
> @@ -484,7 +484,7 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev)
>   
>   	if (unlikely(skb->len > MAX_FRAME_SIZE)) {
>   		dev->stats.tx_errors++;
> -		goto out;
> +		goto len_error;
>   	}
>   
>   	/* Save skb pointer. */
> @@ -575,6 +575,7 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev)
>   map_error:
>   	if (net_ratelimit())
>   		dev_warn(greth->dev, "Could not create TX DMA mapping\n");
> +len_error:
>   	dev_kfree_skb(skb);
>   out:
>   	return err;

Reviewed-by: Gerhard Engleder <gerhard@...leder-embedded.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ