lkml.org 
[lkml]   [2023]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@marvell.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.

\
 
 \ /
  Last update: 2023-12-18 17:24    [W:0.062 / U:1.668 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site