All of lore.kernel.org
 help / color / mirror / Atom feed
* two bsg fixes
@ 2021-07-31  7:40 Christoph Hellwig
  2021-07-31  7:40 ` [PATCH 1/2] scsi: bsg: fix commands without data transfer in scsi_bsg_sg_io_fn Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christoph Hellwig @ 2021-07-31  7:40 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: Jens Axboe, FUJITA Tomonori, linux-block, linux-scsi

Hi Martin,

this series contains two small fixes for commands without data transfer
for the recent bsg changes.

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

* [PATCH 1/2] scsi: bsg: fix commands without data transfer in scsi_bsg_sg_io_fn
  2021-07-31  7:40 two bsg fixes Christoph Hellwig
@ 2021-07-31  7:40 ` Christoph Hellwig
  2021-07-31  7:40 ` [PATCH 2/2] bsg-lib: fix commands without data transfer in bsg_transport_sg_io_fn Christoph Hellwig
  2021-08-01 17:22 ` two bsg fixes Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2021-07-31  7:40 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: Jens Axboe, FUJITA Tomonori, linux-block, linux-scsi

Set ret to 0 after the initial permission checks to avoid leaking
-EPERM for commands without data transfer.

Fixes: 75ca56409e5b ("scsi: bsg: Move the whole request execution into the SCSI/transport handlers")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/scsi/scsi_bsg.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/scsi_bsg.c b/drivers/scsi/scsi_bsg.c
index d13a67b82429..81c3853a2a80 100644
--- a/drivers/scsi/scsi_bsg.c
+++ b/drivers/scsi/scsi_bsg.c
@@ -47,6 +47,7 @@ static int scsi_bsg_sg_io_fn(struct request_queue *q, struct sg_io_v4 *hdr,
 	if (!scsi_cmd_allowed(sreq->cmd, mode))
 		goto out_free_cmd;
 
+	ret = 0;
 	if (hdr->dout_xfer_len) {
 		ret = blk_rq_map_user(rq->q, rq, NULL, uptr64(hdr->dout_xferp),
 				hdr->dout_xfer_len, GFP_KERNEL);
-- 
2.30.2


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

* [PATCH 2/2] bsg-lib: fix commands without data transfer in bsg_transport_sg_io_fn
  2021-07-31  7:40 two bsg fixes Christoph Hellwig
  2021-07-31  7:40 ` [PATCH 1/2] scsi: bsg: fix commands without data transfer in scsi_bsg_sg_io_fn Christoph Hellwig
@ 2021-07-31  7:40 ` Christoph Hellwig
  2021-08-01 17:22 ` two bsg fixes Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2021-07-31  7:40 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: Jens Axboe, FUJITA Tomonori, linux-block, linux-scsi

Set ret to 0 after the initial permission checks to avoid leaking
-EPERM for commands without data transfer.

Fixes: 75ca56409e5b ("scsi: bsg: Move the whole request execution into the SCSI/transport
handlers")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/bsg-lib.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/bsg-lib.c b/block/bsg-lib.c
index 239ebf747141..ccb98276c964 100644
--- a/block/bsg-lib.c
+++ b/block/bsg-lib.c
@@ -72,6 +72,7 @@ static int bsg_transport_sg_io_fn(struct request_queue *q, struct sg_io_v4 *hdr,
 		job->bidi_bio = NULL;
 	}
 
+	ret = 0;
 	if (hdr->dout_xfer_len) {
 		ret = blk_rq_map_user(rq->q, rq, NULL, uptr64(hdr->dout_xferp),
 				hdr->dout_xfer_len, GFP_KERNEL);
-- 
2.30.2


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

* Re: two bsg fixes
  2021-07-31  7:40 two bsg fixes Christoph Hellwig
  2021-07-31  7:40 ` [PATCH 1/2] scsi: bsg: fix commands without data transfer in scsi_bsg_sg_io_fn Christoph Hellwig
  2021-07-31  7:40 ` [PATCH 2/2] bsg-lib: fix commands without data transfer in bsg_transport_sg_io_fn Christoph Hellwig
@ 2021-08-01 17:22 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2021-08-01 17:22 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Martin K. Petersen, Jens Axboe, FUJITA Tomonori, linux-block, linux-scsi


Christoph,

> this series contains two small fixes for commands without data
> transfer for the recent bsg changes.

Applied to 5.15/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2021-08-01 17:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-31  7:40 two bsg fixes Christoph Hellwig
2021-07-31  7:40 ` [PATCH 1/2] scsi: bsg: fix commands without data transfer in scsi_bsg_sg_io_fn Christoph Hellwig
2021-07-31  7:40 ` [PATCH 2/2] bsg-lib: fix commands without data transfer in bsg_transport_sg_io_fn Christoph Hellwig
2021-08-01 17:22 ` two bsg fixes Martin K. Petersen

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.