* [net-next PATCH] octeontx2-af: Fix rvu_mbox_init return path
@ 2025-06-18 13:57 Subbaraya Sundeep
2025-06-18 19:43 ` Simon Horman
2025-06-21 11:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 5+ messages in thread
From: Subbaraya Sundeep @ 2025-06-18 13:57 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, sgoutham, lcherian,
gakula, jerinj, hkelam, saikrishnag
Cc: netdev, Subbaraya Sundeep
rvu_mbox_init function makes use of error path for
freeing memory which are local to the function in
both success and failure conditions. This is unusual hence
fix it by returning zero on success. With new cn20k code this
is freeing valid memory in success case also.
Fixes: e53ee4acb220 ("octeontx2-af: CN20k basic mbox operations and structures")
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
---
drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
index bfee71f4..7e538ee 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
@@ -2573,7 +2573,11 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw,
mwork->rvu = rvu;
INIT_WORK(&mwork->work, mbox_up_handler);
}
- goto free_regions;
+
+ kfree(mbox_regions);
+ bitmap_free(pf_bmap);
+
+ return 0;
exit:
destroy_workqueue(mw->mbox_wq);
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [net-next PATCH] octeontx2-af: Fix rvu_mbox_init return path
2025-06-18 13:57 [net-next PATCH] octeontx2-af: Fix rvu_mbox_init return path Subbaraya Sundeep
@ 2025-06-18 19:43 ` Simon Horman
2025-06-20 11:14 ` Subbaraya Sundeep
2025-06-21 11:40 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 5+ messages in thread
From: Simon Horman @ 2025-06-18 19:43 UTC (permalink / raw)
To: Subbaraya Sundeep
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, sgoutham, lcherian,
gakula, jerinj, hkelam, saikrishnag, netdev
On Wed, Jun 18, 2025 at 07:27:16PM +0530, Subbaraya Sundeep wrote:
> rvu_mbox_init function makes use of error path for
> freeing memory which are local to the function in
> both success and failure conditions. This is unusual hence
> fix it by returning zero on success. With new cn20k code this
> is freeing valid memory in success case also.
>
> Fixes: e53ee4acb220 ("octeontx2-af: CN20k basic mbox operations and structures")
> Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Although I don't think the problem is introduced by this patch
with it applied Smatch notices that the following code, around line 2528,
which jumps to free_regions does so with err uninitialised. This is a
problem because the jump will result in the function returning err.
switch (type) {
case TYPE_AFPF
...
default:
goto free_regions;
}
...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [net-next PATCH] octeontx2-af: Fix rvu_mbox_init return path
2025-06-18 19:43 ` Simon Horman
@ 2025-06-20 11:14 ` Subbaraya Sundeep
2025-06-20 20:00 ` Simon Horman
0 siblings, 1 reply; 5+ messages in thread
From: Subbaraya Sundeep @ 2025-06-20 11:14 UTC (permalink / raw)
To: Simon Horman
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, sgoutham, lcherian,
gakula, jerinj, hkelam, saikrishnag, netdev
On 2025-06-18 at 19:43:01, Simon Horman (horms@kernel.org) wrote:
> On Wed, Jun 18, 2025 at 07:27:16PM +0530, Subbaraya Sundeep wrote:
> > rvu_mbox_init function makes use of error path for
> > freeing memory which are local to the function in
> > both success and failure conditions. This is unusual hence
> > fix it by returning zero on success. With new cn20k code this
> > is freeing valid memory in success case also.
> >
> > Fixes: e53ee4acb220 ("octeontx2-af: CN20k basic mbox operations and structures")
> > Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
>
> Reviewed-by: Simon Horman <horms@kernel.org>
>
> Although I don't think the problem is introduced by this patch
> with it applied Smatch notices that the following code, around line 2528,
> which jumps to free_regions does so with err uninitialised. This is a
> problem because the jump will result in the function returning err.
Thanks Simon for review. I will send fix for Smatch error in
separate patch later.
Sundeep
>
> switch (type) {
> case TYPE_AFPF
> ...
> default:
>
> goto free_regions;
> }
>
> ...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [net-next PATCH] octeontx2-af: Fix rvu_mbox_init return path
2025-06-20 11:14 ` Subbaraya Sundeep
@ 2025-06-20 20:00 ` Simon Horman
0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2025-06-20 20:00 UTC (permalink / raw)
To: Subbaraya Sundeep
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, sgoutham, lcherian,
gakula, jerinj, hkelam, saikrishnag, netdev
On Fri, Jun 20, 2025 at 11:14:43AM +0000, Subbaraya Sundeep wrote:
> On 2025-06-18 at 19:43:01, Simon Horman (horms@kernel.org) wrote:
> > On Wed, Jun 18, 2025 at 07:27:16PM +0530, Subbaraya Sundeep wrote:
> > > rvu_mbox_init function makes use of error path for
> > > freeing memory which are local to the function in
> > > both success and failure conditions. This is unusual hence
> > > fix it by returning zero on success. With new cn20k code this
> > > is freeing valid memory in success case also.
> > >
> > > Fixes: e53ee4acb220 ("octeontx2-af: CN20k basic mbox operations and structures")
> > > Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
> >
> > Reviewed-by: Simon Horman <horms@kernel.org>
> >
> > Although I don't think the problem is introduced by this patch
> > with it applied Smatch notices that the following code, around line 2528,
> > which jumps to free_regions does so with err uninitialised. This is a
> > problem because the jump will result in the function returning err.
>
> Thanks Simon for review. I will send fix for Smatch error in
> separate patch later.
Excellent, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [net-next PATCH] octeontx2-af: Fix rvu_mbox_init return path
2025-06-18 13:57 [net-next PATCH] octeontx2-af: Fix rvu_mbox_init return path Subbaraya Sundeep
2025-06-18 19:43 ` Simon Horman
@ 2025-06-21 11:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-06-21 11:40 UTC (permalink / raw)
To: Subbaraya Sundeep
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, sgoutham, lcherian,
gakula, jerinj, hkelam, saikrishnag, netdev
Hello:
This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:
On Wed, 18 Jun 2025 19:27:16 +0530 you wrote:
> rvu_mbox_init function makes use of error path for
> freeing memory which are local to the function in
> both success and failure conditions. This is unusual hence
> fix it by returning zero on success. With new cn20k code this
> is freeing valid memory in success case also.
>
> Fixes: e53ee4acb220 ("octeontx2-af: CN20k basic mbox operations and structures")
> Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
>
> [...]
Here is the summary with links:
- [net-next] octeontx2-af: Fix rvu_mbox_init return path
https://git.kernel.org/netdev/net-next/c/0289c51f889e
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] 5+ messages in thread
end of thread, other threads:[~2025-06-21 11:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-18 13:57 [net-next PATCH] octeontx2-af: Fix rvu_mbox_init return path Subbaraya Sundeep
2025-06-18 19:43 ` Simon Horman
2025-06-20 11:14 ` Subbaraya Sundeep
2025-06-20 20:00 ` Simon Horman
2025-06-21 11: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).