scsi: bnx2fc: Fix NULL dereference in error handling
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 1 Nov 2018 05:25:30 +0000 (08:25 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Jan 2019 09:00:57 +0000 (10:00 +0100)
[ Upstream commit 9ae4f8420ed7be4b13c96600e3568c144d101a23 ]

If "interface" is NULL then we can't release it and trying to will only
lead to an Oops.

Fixes: aea71a024914 ("[SCSI] bnx2fc: Introduce interface structure for each vlan interface")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/bnx2fc/bnx2fc_fcoe.c

index 6844ba36161638d995f3d5d5135c160fc54bc9ed..89f09b1221352fcd5502a1dc9cff37756cf5d406 100644 (file)
@@ -2372,7 +2372,7 @@ static int _bnx2fc_create(struct net_device *netdev,
        if (!interface) {
                printk(KERN_ERR PFX "bnx2fc_interface_create failed\n");
                rc = -ENOMEM;
-               goto ifput_err;
+               goto netdev_err;
        }
 
        if (is_vlan_dev(netdev)) {