kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] octeontx2-af: fix the double free in rvu_npc_freemem()
@ 2024-04-24  2:27 Su Hui
  2024-04-24  4:05 ` [EXTERNAL] " Geethasowjanya Akula
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Su Hui @ 2024-04-24  2:27 UTC (permalink / raw)
  To: sgoutham, lcherian, gakula, jerinj, hkelam, sbhatta, davem,
	edumazet, kuba, pabeni, nathan, ndesaulniers, morbo, justinstitt
  Cc: Su Hui, sumang, netdev, linux-kernel, llvm, kernel-janitors

Clang static checker(scan-build) warning:
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c:line 2184, column 2
Attempt to free released memory.

npc_mcam_rsrcs_deinit() has released 'mcam->counters.bmap'. Deleted this
redundant kfree() to fix this double free problem.

Fixes: dd7842878633 ("octeontx2-af: Add new devlink param to configure maximum usable NIX block LFs")
Signed-off-by: Su Hui <suhui@nfschina.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
index be709f83f331..e8b73b9d75e3 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
@@ -2181,7 +2181,6 @@ void rvu_npc_freemem(struct rvu *rvu)
 
 	kfree(pkind->rsrc.bmap);
 	npc_mcam_rsrcs_deinit(rvu);
-	kfree(mcam->counters.bmap);
 	if (rvu->kpu_prfl_addr)
 		iounmap(rvu->kpu_prfl_addr);
 	else
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [EXTERNAL] [PATCH net] octeontx2-af: fix the double free in rvu_npc_freemem()
  2024-04-24  2:27 [PATCH net] octeontx2-af: fix the double free in rvu_npc_freemem() Su Hui
@ 2024-04-24  4:05 ` Geethasowjanya Akula
  2024-04-24  4:05 ` Kalesh Anakkur Purayil
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Geethasowjanya Akula @ 2024-04-24  4:05 UTC (permalink / raw)
  To: Su Hui, Sunil Kovvuri Goutham, Linu Cherian, Jerin Jacob,
	Hariprasad Kelam, Subbaraya Sundeep Bhatta, davem, edumazet,
	kuba, pabeni, nathan, ndesaulniers, morbo, justinstitt
  Cc: Suman Ghosh, netdev, linux-kernel, llvm, kernel-janitors



> -----Original Message-----
> From: Su Hui <suhui@nfschina.com>
> Sent: Wednesday, April 24, 2024 7:57 AM
> To: Sunil Kovvuri Goutham <sgoutham@marvell.com>; Linu Cherian
> <lcherian@marvell.com>; Geethasowjanya Akula <gakula@marvell.com>;
> Jerin Jacob <jerinj@marvell.com>; Hariprasad Kelam
> <hkelam@marvell.com>; Subbaraya Sundeep Bhatta
> <sbhatta@marvell.com>; davem@davemloft.net; edumazet@google.com;
> kuba@kernel.org; pabeni@redhat.com; nathan@kernel.org;
> ndesaulniers@google.com; morbo@google.com; justinstitt@google.com
> Cc: Su Hui <suhui@nfschina.com>; Suman Ghosh <sumang@marvell.com>;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org; llvm@lists.linux.dev;
> kernel-janitors@vger.kernel.org
> Subject: [EXTERNAL] [PATCH net] octeontx2-af: fix the double free in
> rvu_npc_freemem()
> ----------------------------------------------------------------------
> Clang static checker(scan-build) warning:
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c:line 2184, column 2
> Attempt to free released memory.
> 
> npc_mcam_rsrcs_deinit() has released 'mcam->counters.bmap'. Deleted this
> redundant kfree() to fix this double free problem.
> 
> Fixes: dd7842878633 ("octeontx2-af: Add new devlink param to configure
> maximum usable NIX block LFs")
> Signed-off-by: Su Hui <suhui@nfschina.com>
> ---
>  drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> index be709f83f331..e8b73b9d75e3 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> @@ -2181,7 +2181,6 @@ void rvu_npc_freemem(struct rvu *rvu)
> 
>  	kfree(pkind->rsrc.bmap);
>  	npc_mcam_rsrcs_deinit(rvu);
> -	kfree(mcam->counters.bmap);
>  	if (rvu->kpu_prfl_addr)
>  		iounmap(rvu->kpu_prfl_addr);
>  	else
> --
> 2.30.2
Reviewed-by: Geetha sowjanya <gakula@marvell.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net] octeontx2-af: fix the double free in rvu_npc_freemem()
  2024-04-24  2:27 [PATCH net] octeontx2-af: fix the double free in rvu_npc_freemem() Su Hui
  2024-04-24  4:05 ` [EXTERNAL] " Geethasowjanya Akula
@ 2024-04-24  4:05 ` Kalesh Anakkur Purayil
  2024-04-24  4:57   ` ] " Hariprasad Kelam
  2024-04-24  7:56 ` Markus Elfring
  2024-04-25 15:40 ` patchwork-bot+netdevbpf
  3 siblings, 1 reply; 6+ messages in thread
From: Kalesh Anakkur Purayil @ 2024-04-24  4:05 UTC (permalink / raw)
  To: Su Hui
  Cc: sgoutham, lcherian, gakula, jerinj, hkelam, sbhatta, davem,
	edumazet, kuba, pabeni, nathan, ndesaulniers, morbo, justinstitt,
	sumang, netdev, linux-kernel, llvm, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1313 bytes --]

On Wed, Apr 24, 2024 at 7:58 AM Su Hui <suhui@nfschina.com> wrote:
>
> Clang static checker(scan-build) warning:
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c:line 2184, column 2
> Attempt to free released memory.
>
> npc_mcam_rsrcs_deinit() has released 'mcam->counters.bmap'. Deleted this
> redundant kfree() to fix this double free problem.
>
> Fixes: dd7842878633 ("octeontx2-af: Add new devlink param to configure maximum usable NIX block LFs")
> Signed-off-by: Su Hui <suhui@nfschina.com>

LGTM
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> ---
>  drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> index be709f83f331..e8b73b9d75e3 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> @@ -2181,7 +2181,6 @@ void rvu_npc_freemem(struct rvu *rvu)
>
>         kfree(pkind->rsrc.bmap);
>         npc_mcam_rsrcs_deinit(rvu);
> -       kfree(mcam->counters.bmap);
>         if (rvu->kpu_prfl_addr)
>                 iounmap(rvu->kpu_prfl_addr);
>         else
> --
> 2.30.2
>
>


-- 
Regards,
Kalesh A P

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4239 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* ] Re: [PATCH net] octeontx2-af: fix the double free in rvu_npc_freemem()
  2024-04-24  4:05 ` Kalesh Anakkur Purayil
@ 2024-04-24  4:57   ` Hariprasad Kelam
  0 siblings, 0 replies; 6+ messages in thread
From: Hariprasad Kelam @ 2024-04-24  4:57 UTC (permalink / raw)
  To: Kalesh Anakkur Purayil, Su Hui
  Cc: Sunil Kovvuri Goutham, Linu Cherian, Geethasowjanya Akula,
	Jerin Jacob, Subbaraya Sundeep Bhatta, davem, edumazet, kuba,
	pabeni, nathan, ndesaulniers, morbo, justinstitt, Suman Ghosh,
	netdev, linux-kernel, llvm, kernel-janitors



> On Wed, Apr 24, 2024 at 7:58 AM Su Hui <suhui@nfschina.com> wrote:
> >
> > Clang static checker(scan-build) warning:
> > drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c:line 2184, column 2
> > Attempt to free released memory.
> >
> > npc_mcam_rsrcs_deinit() has released 'mcam->counters.bmap'. Deleted
> this
> > redundant kfree() to fix this double free problem.
> >
> > Fixes: dd7842878633 ("octeontx2-af: Add new devlink param to configure
> maximum usable NIX block LFs")
> > Signed-off-by: Su Hui <suhui@nfschina.com>

Reviewed-by: Hariprasad Kelam <hkelam@marvell.com>
> 
> LGTM
> Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> > ---
> >  drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> > index be709f83f331..e8b73b9d75e3 100644
> > --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> > +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> > @@ -2181,7 +2181,6 @@ void rvu_npc_freemem(struct rvu *rvu)
> >
> >         kfree(pkind->rsrc.bmap);
> >         npc_mcam_rsrcs_deinit(rvu);
> > -       kfree(mcam->counters.bmap);
> >         if (rvu->kpu_prfl_addr)
> >                 iounmap(rvu->kpu_prfl_addr);
> >         else
> > --
> > 2.30.2
> >
> >
> 
> 
> --
> Regards,
> Kalesh A P

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net] octeontx2-af: fix the double free in rvu_npc_freemem()
  2024-04-24  2:27 [PATCH net] octeontx2-af: fix the double free in rvu_npc_freemem() Su Hui
  2024-04-24  4:05 ` [EXTERNAL] " Geethasowjanya Akula
  2024-04-24  4:05 ` Kalesh Anakkur Purayil
@ 2024-04-24  7:56 ` Markus Elfring
  2024-04-25 15:40 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2024-04-24  7:56 UTC (permalink / raw)
  To: Su Hui, netdev, kernel-janitors, Bill Wendling, David S. Miller,
	Eric Dumazet, Geethasowjanya Akula, Hariprasad Kelam,
	Jakub Kicinski, Jerin Jacob, Justin Stitt,
	Kalesh Anakkur Purayil, Linu Cherian, Nathan Chancellor,
	Nick Desaulniers, Paolo Abeni, Subbaraya Sundeep Bhatta,
	Sunil Kovvuri Goutham
  Cc: LKML, llvm, Suman Ghosh

…
> npc_mcam_rsrcs_deinit() has released 'mcam->counters.bmap'. Deleted this
> redundant kfree() to fix this double free problem.
…

Can a wording variant (like the following) be a bit nicer?

   The object “mcam->counters.bmap” was released during the execution of
   the function “npc_mcam_rsrcs_deinit”.
   Delete a subsequent kfree() call to fix this double free problem.


Regards,
Markus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net] octeontx2-af: fix the double free in rvu_npc_freemem()
  2024-04-24  2:27 [PATCH net] octeontx2-af: fix the double free in rvu_npc_freemem() Su Hui
                   ` (2 preceding siblings ...)
  2024-04-24  7:56 ` Markus Elfring
@ 2024-04-25 15:40 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-04-25 15:40 UTC (permalink / raw)
  To: Su Hui
  Cc: sgoutham, lcherian, gakula, jerinj, hkelam, sbhatta, davem,
	edumazet, kuba, pabeni, nathan, ndesaulniers, morbo, justinstitt,
	sumang, netdev, linux-kernel, llvm, kernel-janitors

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 24 Apr 2024 10:27:25 +0800 you wrote:
> Clang static checker(scan-build) warning:
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c:line 2184, column 2
> Attempt to free released memory.
> 
> npc_mcam_rsrcs_deinit() has released 'mcam->counters.bmap'. Deleted this
> redundant kfree() to fix this double free problem.
> 
> [...]

Here is the summary with links:
  - [net] octeontx2-af: fix the double free in rvu_npc_freemem()
    https://git.kernel.org/netdev/net/c/6e965eba43e9

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-25 15:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24  2:27 [PATCH net] octeontx2-af: fix the double free in rvu_npc_freemem() Su Hui
2024-04-24  4:05 ` [EXTERNAL] " Geethasowjanya Akula
2024-04-24  4:05 ` Kalesh Anakkur Purayil
2024-04-24  4:57   ` ] " Hariprasad Kelam
2024-04-24  7:56 ` Markus Elfring
2024-04-25 15:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).