mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 21:33:52 +00:00
bnxt_en: Fix possible memory leak in bnxt_rdma_aux_device_init()
[ Upstream commit7ac10c7d72
] 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:3034322113
("bnxt_en: Remove runtime interrupt vector allocation") Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com> Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
1e91775286
commit
c60ed82553
1 changed files with 2 additions and 1 deletions
|
@ -394,12 +394,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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue