Skip to content

Commit 244359c

Browse files
Dan Carpentermartinkpetersen
authored andcommitted
scsi: libsas: Fix error path in sas_notify_lldd_dev_found()
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: 735f7d2 ("[SCSI] libsas: fix domain_device leak") Reviewed-by: Jason Yan <yanaijie@huawei.com> Acked-by: John Garry <john.garry@huawei.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent b614d55 commit 244359c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/scsi/libsas/sas_discover.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,11 @@ int sas_notify_lldd_dev_found(struct domain_device *dev)
182182
pr_warn("driver on host %s cannot handle device %016llx, error:%d\n",
183183
dev_name(sas_ha->dev),
184184
SAS_ADDR(dev->sas_addr), res);
185+
return res;
185186
}
186187
set_bit(SAS_DEV_FOUND, &dev->state);
187188
kref_get(&dev->kref);
188-
return res;
189+
return 0;
189190
}
190191

191192

0 commit comments

Comments
 (0)