Commit 7ac10c7d authored by Vikas Gupta's avatar Vikas Gupta Committed by David S. Miller
Browse files

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: 30343221 ("bnxt_en: Remove runtime interrupt vector allocation")
Reviewed-by: default avatarAndy Gospodarek <andrew.gospodarek@broadcom.com>
Signed-off-by: default avatarVikas Gupta <vikas.gupta@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 58effa34
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -392,12 +392,13 @@ void bnxt_rdma_aux_device_init(struct bnxt *bp)
	if (!edev)
		goto aux_dev_uninit;

	aux_priv->edev = edev;

	ulp = kzalloc(sizeof(*ulp), GFP_KERNEL);
	if (!ulp)
		goto aux_dev_uninit;

	edev->ulp_tbl = ulp;
	aux_priv->edev = edev;
	bp->edev = edev;
	bnxt_set_edev_info(edev, bp);