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: <20231218162316.GG6288@kernel.org>
Date: Mon, 18 Dec 2023 16:23:16 +0000
From: Simon Horman <horms@...nel.org>
To: Suman Ghosh <sumang@...vell.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
	pabeni@...hat.com, sgoutham@...vell.com, sbhatta@...vell.com,
	jerinj@...vell.com, gakula@...vell.com, hkelam@...vell.com,
	lcherian@...vell.com, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [net-next PATCH] octeontx2-af: Add new devlink param to
 configure maximum usable NIX block LFs

On Fri, Dec 15, 2023 at 05:31:49PM +0530, Suman Ghosh wrote:
> On some silicon variants the number of available CAM entries are
> less. Reserving one entry for each NIX-LF for default DMAC based pkt
> forwarding rules will reduce the number of available CAM entries
> further. Hence add configurability via devlink to set maximum number of
> NIX-LFs needed which inturn frees up some CAM entries.
> 
> Signed-off-by: Suman Ghosh <sumang@...vell.com>

...

> @@ -1964,8 +1977,21 @@ static int npc_mcam_rsrcs_init(struct rvu *rvu, int blkaddr)
>  
>  	return 0;
>  
> -free_mem:
> +free_cntr_refcnt:
> +	kfree(mcam->cntr_refcnt);
> +free_entry_cntr_map:
> +	kfree(mcam->entry2cntr_map);
> +free_cntr_map:
> +	kfree(mcam->cntr2pfvf_map);
> +free_cntr_bmap:
> +	kfree(mcam->counters.bmap);
> +free_entry_map:
> +	kfree(mcam->entry2pfvf_map);
> +free_bmap_reverse:
> +	kfree(mcam->bmap_reverse);
> +free_bmap:
>  	kfree(mcam->counters.bmap);
> +
>  	return -ENOMEM;
>  }
>  

Hi Suman,

I realise that this patch has been accepted.
But I believe there is a double-free problem above
as mcam->counters.bmap may be freed twice.
And mcam->bmap seems to be leaked.

Perhaps the last part of the unwind ladder should be:

free_bmap:
	kfree(mcam->bmap);

Double-free flagged by Smatch and Coccinelle.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ