All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	Dan Williams <dan.j.williams@intel.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Jason Yan <yanaijie@huawei.com>, <linux-scsi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] scsi: libsas: Fix error path in sas_notify_lldd_dev_found()
Date: Mon, 7 Sep 2020 09:54:51 +0100	[thread overview]
Message-ID: <4ef45b15-34fd-80e9-1adb-53044ca9fa84@huawei.com> (raw)
In-Reply-To: <20200905125836.GF183976@mwanda>

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

>   
>   
> 


WARNING: multiple messages have this Message-ID (diff)
From: John Garry <john.garry@huawei.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	Dan Williams <dan.j.williams@intel.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Jason Yan <yanaijie@huawei.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] scsi: libsas: Fix error path in sas_notify_lldd_dev_found()
Date: Mon, 07 Sep 2020 08:54:51 +0000	[thread overview]
Message-ID: <4ef45b15-34fd-80e9-1adb-53044ca9fa84@huawei.com> (raw)
In-Reply-To: <20200905125836.GF183976@mwanda>

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

>   
>   
> 

  parent reply	other threads:[~2020-09-07  8:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-05 12:58 [PATCH] scsi: libsas: Fix error path in sas_notify_lldd_dev_found() Dan Carpenter
2020-09-05 12:58 ` Dan Carpenter
2020-09-07  1:37 ` Jason Yan
2020-09-07  1:37   ` Jason Yan
2020-09-07  8:54 ` John Garry [this message]
2020-09-07  8:54   ` John Garry
2020-09-09  2:08 ` Martin K. Petersen
2020-09-09  2:08   ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ef45b15-34fd-80e9-1adb-53044ca9fa84@huawei.com \
    --to=john.garry@huawei.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dan.j.williams@intel.com \
    --cc=gustavoars@kernel.org \
    --cc=jejb@linux.ibm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=yanaijie@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.