From: Thomas Fourier <fourier.thomas@gmail.com>
Cc: Thomas Fourier <fourier.thomas@gmail.com>,
Sunil Goutham <sgoutham@marvell.com>,
Ratheesh Kannoth <rkannoth@marvell.com>,
Geetha sowjanya <gakula@marvell.com>,
Subbaraya Sundeep <sbhatta@marvell.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org (open list:MARVELL OCTEONTX2 RVU ADMIN
FUNCTION DRIVER)
Subject: [PATCH net] octeontx2-af: Prevent double free in nix_setup_txvlan()
Date: Fri, 4 Dec 2026 15:33:15 +0100 [thread overview]
Message-ID: <20261204143316.649751-2-fourier.thomas@gmail.com> (raw)
When the entry2pfvf_map allocation fails, nix_setup_txvlan() frees
vlan->rsrc.bmap and returns -ENOMEM without clearing the pointer. The
error goes up through rvu_nix_block_init() and rvu_nix_init() to
rvu_setup_hw_resources(), which jumps to nix_err and calls
rvu_nix_freemem(). rvu_nix_block_freemem() then calls
kfree(vlan->rsrc.bmap) a second time.
Set vlan->rsrc.bmap to NULL after freeing it on the error path.
Fixes: 709a4f0c254c ("octeontx2-af: Alloc bitmaps for NIX Tx scheduler queues")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
index 199723d5ec94..6a5643d5fc3a 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
@@ -3804,6 +3804,7 @@ static int nix_setup_txvlan(struct rvu *rvu, struct nix_hw *nix_hw)
free_mem:
kfree(vlan->rsrc.bmap);
+ vlan->rsrc.bmap = NULL;
return -ENOMEM;
}
--
2.53.0
next reply other threads:[~2026-12-04 14:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 14:33 Thomas Fourier [this message]
2026-12-04 14:37 ` [PATCH net] octeontx2-af: Prevent double free in nix_setup_txvlan() netdev-bot+sinfo
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=20261204143316.649751-2-fourier.thomas@gmail.com \
--to=fourier.thomas@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=gakula@marvell.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rkannoth@marvell.com \
--cc=sbhatta@marvell.com \
--cc=sgoutham@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox