Thread (3 messages) 3 messages, 1 author, 2021-07-31

[PATCH 2/2] bsg-lib: fix commands without data transfer in bsg_transport_sg_io_fn

flat view
DORMANTno replies LANDED

From: Christoph Hellwig <hch@lst.de>
Date: 2021-07-31 07:42:34
Also in: linux-scsi
Subsystem: block layer, the rest · Maintainers: Jens Axboe, Linus Torvalds

Landed in mainline as 659a37844abc on 2021-08-01.

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help