All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Yan <yanaijie@huawei.com>
To: martin.petersen@oracle.com, jejb@linux.vnet.ibm.com
Cc: linux-scsi@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] scsi: libsas: fix length error in sas_smp_handler()
Date: Thu, 7 Dec 2017 09:41:13 +0800	[thread overview]
Message-ID: <5A289C39.8080203@huawei.com> (raw)
In-Reply-To: <20171205093943.40116-1-yanaijie@huawei.com>

Can anybody review this patch? Our test of SG_IO all failed because of
this bug.

On 2017/12/5 17:39, Jason Yan wrote:
> The bsg_job_done() requires the length of payload received, but we give
> it the untransferred residual.
>
> Fixes: 651a01364994 ("scsi: scsi_transport_sas: switch to bsg-lib for SMP")
> Reported-and-tested-by: chenqilin <chenqilin2@huawei.com>
> Signed-off-by: Jason Yan <yanaijie@huawei.com>
> CC: Christoph Hellwig <hch@lst.de>
> ---
>   drivers/scsi/libsas/sas_expander.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
> index 50cb0f3..8323dc1 100644
> --- a/drivers/scsi/libsas/sas_expander.c
> +++ b/drivers/scsi/libsas/sas_expander.c
> @@ -2177,9 +2177,9 @@ void sas_smp_handler(struct bsg_job *job, struct Scsi_Host *shost,
>
>   	ret = smp_execute_task_sg(dev, job->request_payload.sg_list,
>   			job->reply_payload.sg_list);
> -	if (ret > 0) {
> +	if (ret >= 0) {
>   		/* positive number is the untransferred residual */
> -		reslen = ret;
> +		reslen = job->reply_payload.payload_len - ret;
>   		ret = 0;
>   	}
>
>

  reply	other threads:[~2017-12-07  1:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-05  9:39 [PATCH] scsi: libsas: fix length error in sas_smp_handler() Jason Yan
2017-12-07  1:41 ` Jason Yan [this message]
2017-12-07  9:27   ` John Garry
2017-12-07 10:26     ` Jason Yan

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=5A289C39.8080203@huawei.com \
    --to=yanaijie@huawei.com \
    --cc=hch@lst.de \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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.