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: <ea04dcab-e399-4c96-a5cd-db921a1bbb42@intel.com>
Date: Tue, 4 Mar 2025 07:46:06 -0700
From: Ahmed Zaki <ahmed.zaki@...el.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
CC: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
	<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
	<pabeni@...hat.com>, Simon Horman <horms@...nel.org>, Kuniyuki Iwashima
	<kuniyu@...zon.com>, Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
	Alexander Lobakin <aleksander.lobakin@...el.com>, <netdev@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH v2 net-next] net: Silence use after free static checker
 warning



On 2025-03-04 12:01 a.m., Dan Carpenter wrote:
> The cpu_rmap_put() will call kfree() when the last reference is dropped.
> 
> Fortunately, this is not the the last reference so it won't free it
> here.  Unfortunately, static checkers are not clever enough and they
> still warn that this could lead to a use after free on the next line.
> Flip these two statements around to silence the static checker false
> positve.

nit: *positive.

Beside that:

Reviewed-by: Ahmed Zaki <ahmed.zaki@...el.com>

Thanks.



> 
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
>   net/core/dev.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 9189c4a048d7..c102349e04ee 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -7072,8 +7072,8 @@ void netif_napi_set_irq_locked(struct napi_struct *napi, int irq)
>   put_rmap:
>   #ifdef CONFIG_RFS_ACCEL
>   	if (napi->dev->rx_cpu_rmap_auto) {
> -		cpu_rmap_put(napi->dev->rx_cpu_rmap);
>   		napi->dev->rx_cpu_rmap->obj[napi->napi_rmap_idx] = NULL;
> +		cpu_rmap_put(napi->dev->rx_cpu_rmap);
>   		napi->napi_rmap_idx = -1;
>   	}
>   #endif


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ