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] [day] [month] [year] [list]
Message-ID: <yf42hl2qh2ah2egswvlzscpywtooo4zqod2trx3hpmrf4fj4bd@zesc4vyus3le>
Date: Mon, 8 Jul 2024 08:01:15 +0200
From: Uwe Kleine-König <u.kleine-koenig@...libre.com>
To: Aleksander Jan Bajkowski <olek2@...pl>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org, 
	pabeni@...hat.com, jacob.e.keller@...el.com, netdev@...r.kernel.org, 
	linux-kernel@...r.kernel.org, Joe Perches <joe@...ches.com>, Andrew Lunn <andrew@...n.ch>
Subject: Re: [PATCH [net] v2 1/1] net: ethernet: lantiq_etop: fix double free
 in detach

Hello,

On Sun, Jul 07, 2024 at 06:17:13PM +0200, Aleksander Jan Bajkowski wrote:
> The number of the currently released descriptor is never incremented
> which results in the same skb being released multiple times.
> 
> Fixes: 504d4721ee8e ("MIPS: Lantiq: Add ethernet driver")
> Reported-by: Joe Perches <joe@...ches.com>
> Closes: https://lore.kernel.org/all/fc1bf93d92bb5b2f99c6c62745507cc22f3a7b2d.camel@perches.com/
> Signed-off-by: Aleksander Jan Bajkowski <olek2@...pl>
> Reviewed-by: Andrew Lunn <andrew@...n.ch>
> ---
>  drivers/net/ethernet/lantiq_etop.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
> index 5352fee62d2b..2a18e473bac2 100644
> --- a/drivers/net/ethernet/lantiq_etop.c
> +++ b/drivers/net/ethernet/lantiq_etop.c
> @@ -217,9 +217,8 @@ ltq_etop_free_channel(struct net_device *dev, struct ltq_etop_chan *ch)
>  	if (ch->dma.irq)
>  		free_irq(ch->dma.irq, priv);
>  	if (IS_RX(ch->idx)) {
> -		int desc;
> -
> -		for (desc = 0; desc < LTQ_DESC_NUM; desc++)
> +		for (ch->dma.desc = 0; ch->dma.desc < LTQ_DESC_NUM;
> +		     ch->dma.desc++)
>  			dev_kfree_skb_any(ch->skb[ch->dma.desc]);

I liked the first version better.

If you care about the line length make it:

diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 5352fee62d2b..3dabe56d6f62 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -217,10 +217,10 @@ ltq_etop_free_channel(struct net_device *dev, struct ltq_etop_chan *ch)
 	if (ch->dma.irq)
 		free_irq(ch->dma.irq, priv);
 	if (IS_RX(ch->idx)) {
-		int desc;
+		struct ltq_dma_channel *dma = &ch->dma;
 
-		for (desc = 0; desc < LTQ_DESC_NUM; desc++)
-			dev_kfree_skb_any(ch->skb[ch->dma.desc]);
+		for (dma->desc = 0; dma->desc < LTQ_DESC_NUM; dma->desc++)
+			dev_kfree_skb_any(ch->skb[dma->desc]);
 	}
 }
 
Best regards
Uwe

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ