All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Suman Ghosh <sumang@marvell.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, sgoutham@marvell.com, sbhatta@marvell.com,
	jerinj@marvell.com, gakula@marvell.com, hkelam@marvell.com,
	lcherian@marvell.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [net-next PATCH] octeontx2-af: Add new devlink param to configure maximum usable NIX block LFs
Date: Mon, 18 Dec 2023 16:23:16 +0000	[thread overview]
Message-ID: <20231218162316.GG6288@kernel.org> (raw)
In-Reply-To: <20231215120149.160122-1-sumang@marvell.com>

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.

  parent reply	other threads:[~2023-12-18 16:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15 12:01 [net-next PATCH] octeontx2-af: Add new devlink param to configure maximum usable NIX block LFs Suman Ghosh
2023-12-17 20:13 ` patchwork-bot+netdevbpf
2023-12-18 16:23 ` Simon Horman [this message]
2023-12-18 18:03   ` [EXT] " Suman Ghosh
2023-12-18 19:10     ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231218162316.GG6288@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gakula@marvell.com \
    --cc=hkelam@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kuba@kernel.org \
    --cc=lcherian@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    --cc=sumang@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.