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 --- 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