Skip to content

Commit 7ac10c7

Browse files
vikasbrcmdavem330
authored andcommitted
bnxt_en: Fix possible memory leak in bnxt_rdma_aux_device_init()
If ulp = kzalloc() fails, the allocated edev will leak because it is not properly assigned and the cleanup path will not be able to free it. Fix it by assigning it properly immediately after allocation. Fixes: 3034322 ("bnxt_en: Remove runtime interrupt vector allocation") Reviewed-by: Andy Gospodarek <[email protected]> Signed-off-by: Vikas Gupta <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 58effa3 commit 7ac10c7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,12 +392,13 @@ void bnxt_rdma_aux_device_init(struct bnxt *bp)
392392
if (!edev)
393393
goto aux_dev_uninit;
394394

395+
aux_priv->edev = edev;
396+
395397
ulp = kzalloc(sizeof(*ulp), GFP_KERNEL);
396398
if (!ulp)
397399
goto aux_dev_uninit;
398400

399401
edev->ulp_tbl = ulp;
400-
aux_priv->edev = edev;
401402
bp->edev = edev;
402403
bnxt_set_edev_info(edev, bp);
403404

0 commit comments

Comments
 (0)