lkml.org 
[lkml]   [2020]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] scsi: libsas: Fix error path in sas_notify_lldd_dev_found()
Date
On 05/09/2020 13:58, Dan Carpenter wrote:
> In sas_notify_lldd_dev_found(), if we can't find a device,

nit: the callback is for the LLDD is to allocate resources, device
context etc., for that domain_device, and not find the device. The
device has been found at this point.

> 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.
>
> Fixes: 735f7d2fedf5 ("[SCSI] libsas: fix domain_device leak")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/scsi/libsas/sas_discover.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
> index cd7c7d269f6f..d0f9e90e3279 100644
> --- a/drivers/scsi/libsas/sas_discover.c
> +++ b/drivers/scsi/libsas/sas_discover.c
> @@ -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 looks ok.

> }

Thanks,
John

>
>
>

\
 
 \ /
  Last update: 2020-09-07 10:58    [W:0.042 / U:0.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site