All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bsg: fix bogus EINVAL on non-data commands
@ 2018-07-10 16:52 Tony Battersby
  2018-07-11  6:37 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Tony Battersby @ 2018-07-10 16:52 UTC (permalink / raw)
  To: FUJITA Tomonori, Jens Axboe, Christoph Hellwig, linux-scsi,
	linux-block
  Cc: Hannes Reinecke, Johannes Thumshirn

Fix a regression introduced in Linux kernel 4.17 where sending a SCSI
command that does not transfer data (such as TEST UNIT READY) via
/dev/bsg/* results in EINVAL.

Fixes: 17cb960f29c2 ("bsg: split handling of SCSI CDBs vs transport requeues")
Cc: <stable@vger.kernel.org> # 4.17+
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
---
diff --git a/block/bsg.c b/block/bsg.c
index 66602c4..b16ab6f 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -268,7 +268,7 @@ bsg_map_hdr(struct request_queue *q, str
 		ret = blk_rq_map_user(q, rq, NULL, uptr64(hdr->din_xferp),
 				hdr->din_xfer_len, GFP_KERNEL);
 	} else {
-		ret = blk_rq_map_user(q, rq, NULL, NULL, 0, GFP_KERNEL);
+		ret = 0;
 	}
 
 	if (ret)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] bsg: fix bogus EINVAL on non-data commands
  2018-07-10 16:52 [PATCH] bsg: fix bogus EINVAL on non-data commands Tony Battersby
@ 2018-07-11  6:37 ` Christoph Hellwig
  2018-07-11 14:46   ` [PATCH v2] " Tony Battersby
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2018-07-11  6:37 UTC (permalink / raw)
  To: Tony Battersby
  Cc: FUJITA Tomonori, Jens Axboe, Christoph Hellwig, linux-scsi,
	linux-block, Hannes Reinecke, Johannes Thumshirn

On Tue, Jul 10, 2018 at 12:52:24PM -0400, Tony Battersby wrote:
> Fix a regression introduced in Linux kernel 4.17 where sending a SCSI
> command that does not transfer data (such as TEST UNIT READY) via
> /dev/bsg/* results in EINVAL.
> 
> Fixes: 17cb960f29c2 ("bsg: split handling of SCSI CDBs vs transport requeues")
> Cc: <stable@vger.kernel.org> # 4.17+
> Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
> ---
> diff --git a/block/bsg.c b/block/bsg.c
> index 66602c4..b16ab6f 100644
> --- a/block/bsg.c
> +++ b/block/bsg.c
> @@ -268,7 +268,7 @@ bsg_map_hdr(struct request_queue *q, str
>  		ret = blk_rq_map_user(q, rq, NULL, uptr64(hdr->din_xferp),
>  				hdr->din_xfer_len, GFP_KERNEL);
>  	} else {
> -		ret = blk_rq_map_user(q, rq, NULL, NULL, 0, GFP_KERNEL);
> +		ret = 0;
>  	}

We can remove the else branch entirely as ret already is 0 here.

Otherwise this looks fine and restores the previous behavior:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] bsg: fix bogus EINVAL on non-data commands
  2018-07-11  6:37 ` Christoph Hellwig
@ 2018-07-11 14:46   ` Tony Battersby
  2018-07-11 14:48     ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Tony Battersby @ 2018-07-11 14:46 UTC (permalink / raw)
  To: Christoph Hellwig, FUJITA Tomonori, Jens Axboe, linux-scsi,
	linux-block
  Cc: Hannes Reinecke, Johannes Thumshirn

Fix a regression introduced in Linux kernel 4.17 where sending a SCSI
command that does not transfer data (such as TEST UNIT READY) via
/dev/bsg/* results in EINVAL.

Fixes: 17cb960f29c2 ("bsg: split handling of SCSI CDBs vs transport requeues")
Cc: <stable@vger.kernel.org> # 4.17+
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
---
diff --git a/block/bsg.c b/block/bsg.c
index 66602c4..3da540f 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -267,8 +267,6 @@ bsg_map_hdr(struct request_queue *q, str
 	} else if (hdr->din_xfer_len) {
 		ret = blk_rq_map_user(q, rq, NULL, uptr64(hdr->din_xferp),
 				hdr->din_xfer_len, GFP_KERNEL);
-	} else {
-		ret = blk_rq_map_user(q, rq, NULL, NULL, 0, GFP_KERNEL);
 	}
 
 	if (ret)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] bsg: fix bogus EINVAL on non-data commands
  2018-07-11 14:46   ` [PATCH v2] " Tony Battersby
@ 2018-07-11 14:48     ` Jens Axboe
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2018-07-11 14:48 UTC (permalink / raw)
  To: Tony Battersby, Christoph Hellwig, FUJITA Tomonori, linux-scsi,
	linux-block
  Cc: Hannes Reinecke, Johannes Thumshirn

On 7/11/18 8:46 AM, Tony Battersby wrote:
> Fix a regression introduced in Linux kernel 4.17 where sending a SCSI
> command that does not transfer data (such as TEST UNIT READY) via
> /dev/bsg/* results in EINVAL.

Thanks Tony, applied for 4.18.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-11 14:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-10 16:52 [PATCH] bsg: fix bogus EINVAL on non-data commands Tony Battersby
2018-07-11  6:37 ` Christoph Hellwig
2018-07-11 14:46   ` [PATCH v2] " Tony Battersby
2018-07-11 14:48     ` Jens Axboe

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.