2024-04-24 02:29:21

by Su Hui

[permalink] [raw]
Subject: [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 <[email protected]>
---
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



2024-04-24 04:06:47

by Geetha sowjanya

[permalink] [raw]
Subject: RE: [EXTERNAL] [PATCH net] octeontx2-af: fix the double free in rvu_npc_freemem()



> -----Original Message-----
> From: Su Hui <[email protected]>
> Sent: Wednesday, April 24, 2024 7:57 AM
> To: Sunil Kovvuri Goutham <[email protected]>; Linu Cherian
> <[email protected]>; Geethasowjanya Akula <[email protected]>;
> Jerin Jacob <[email protected]>; Hariprasad Kelam
> <[email protected]>; Subbaraya Sundeep Bhatta
> <[email protected]>; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected]
> Cc: Su Hui <[email protected]>; Suman Ghosh <[email protected]>;
> [email protected]; [email protected]; [email protected];
> [email protected]
> 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 <[email protected]>
> ---
> 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 <[email protected]>

2024-04-24 06:08:00

by Kalesh Anakkur Purayil

[permalink] [raw]
Subject: Re: [PATCH net] octeontx2-af: fix the double free in rvu_npc_freemem()

On Wed, Apr 24, 2024 at 7:58 AM Su Hui <[email protected]> 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 <[email protected]>

LGTM
Reviewed-by: Kalesh AP <[email protected]>
> ---
> 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


Attachments:
smime.p7s (4.14 kB)
S/MIME Cryptographic Signature

2024-04-24 07:58:13

by Markus Elfring

[permalink] [raw]
Subject: Re: [PATCH net] octeontx2-af: fix the double free in rvu_npc_freemem()


> 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

2024-04-25 15:41:22

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net] octeontx2-af: fix the double free in rvu_npc_freemem()

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

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