mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Douglas Gilbert <dgilbert@interlog.com>
To: Johannes Thumshirn <jthumshirn@suse.de>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: Linux SCSI Mailinglist <linux-scsi@vger.kernel.org>,
	Linux Kernel Mailinglist <linux-kernel@vger.kernel.org>,
	Chris Clayton <chris2553@googlemail.com>
Subject: Re: [PATCH v2] scsi: sg: fix SG_DXFER_FROM_DEV transfers
Date: Tue, 11 Jul 2017 15:05:41 -0400	[thread overview]
Message-ID: <e34d9674-2e91-a32e-a96b-55028710f933@interlog.com> (raw)
In-Reply-To: <20170707085638.18939-1-jthumshirn@suse.de>

On 2017-07-07 04:56 AM, Johannes Thumshirn wrote:
> SG_DXFER_FROM_DEV transfers do not necessarily have a dxferp as we set
> it to NULL for the old sg_io read/write interface, but must have a length
> bigger than 0. This fixes a regression introduced by commit 28676d869bbb
> ("scsi: sg: check for valid direction before starting the request")
> 
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> Fixes: 28676d869bbb ("scsi: sg: check for valid direction before starting the request")
> Reported-by: Chris Clayton <chris2553@googlemail.com>
> Tested-by: Chris Clayton <chris2553@googlemail.com>
> Cc: Douglas Gilbert <dgilbert@interlog.com>
> Reviewed-by: Hannes Reinecke <hare@suse.com>

Acked-by: Douglas Gilbert <dgilbert@interlog.com>

> ---
> Changes to v1:
> * Fix breakage of the sg_io v3 interface, verified using sg_inq
> 
>   drivers/scsi/sg.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
> index 21225d62b0c1..1e82d4128a84 100644
> --- a/drivers/scsi/sg.c
> +++ b/drivers/scsi/sg.c
> @@ -758,8 +758,11 @@ static bool sg_is_valid_dxfer(sg_io_hdr_t *hp)
>   		if (hp->dxferp || hp->dxfer_len > 0)
>   			return false;
>   		return true;
> -	case SG_DXFER_TO_DEV:
>   	case SG_DXFER_FROM_DEV:
> +		if (hp->dxfer_len < 0)
> +			return false;
> +		return true;
> +	case SG_DXFER_TO_DEV:
>   	case SG_DXFER_TO_FROM_DEV:
>   		if (!hp->dxferp || hp->dxfer_len == 0)
>   			return false;
> 

  parent reply	other threads:[~2017-07-11 19:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-07  8:56 Johannes Thumshirn
2017-07-07 17:59 ` Chris Clayton
2017-07-11 19:05 ` Douglas Gilbert [this message]
2017-07-12 21:17 ` 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=e34d9674-2e91-a32e-a96b-55028710f933@interlog.com \
    --to=dgilbert@interlog.com \
    --cc=chris2553@googlemail.com \
    --cc=jthumshirn@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome