]> Git Repo - linux.git/commitdiff
scsi: libsas: Fix error path in sas_notify_lldd_dev_found()
authorDan Carpenter <[email protected]>
Sat, 5 Sep 2020 12:58:36 +0000 (15:58 +0300)
committerMartin K. Petersen <[email protected]>
Thu, 10 Sep 2020 01:25:02 +0000 (21:25 -0400)
In sas_notify_lldd_dev_found(), if we can't allocate the necessary
resources, then it seems like the wrong thing to mark the device as found
and to increment the reference count.  None of the callers ever drop the
reference in that situation.

[mkp: tweaked commit desc based on feedback from John]

Link: https://lore.kernel.org/r/20200905125836.GF183976@mwanda
Fixes: 735f7d2fedf5 ("[SCSI] libsas: fix domain_device leak")
Reviewed-by: Jason Yan <[email protected]>
Acked-by: John Garry <[email protected]>
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
drivers/scsi/libsas/sas_discover.c

index daf951b0b3f5538fa05f7c7b5e2e99626e18d5cd..13ad2b3d314e27bdd4621d05124ac44da55febd2 100644 (file)
@@ -182,10 +182,11 @@ int sas_notify_lldd_dev_found(struct domain_device *dev)
                pr_warn("driver on host %s cannot handle device %016llx, error:%d\n",
                        dev_name(sas_ha->dev),
                        SAS_ADDR(dev->sas_addr), res);
+               return res;
        }
        set_bit(SAS_DEV_FOUND, &dev->state);
        kref_get(&dev->kref);
-       return res;
+       return 0;
 }
 
 
This page took 0.063054 seconds and 4 git commands to generate.