diff options
author | Christoph Hellwig <hch@lst.de> | 2021-07-31 09:40:27 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2021-08-01 13:21:40 -0400 |
commit | 659a37844abc00c3dc676bb1faed29c1dacbf59f (patch) | |
tree | e5ae57652b01a98ab280dd853f8897369b199e10 /block/bsg-lib.c | |
parent | 5c0f61377b765e650b1bc85298b79add1148c97f (diff) | |
download | linux-659a37844abc00c3dc676bb1faed29c1dacbf59f.tar.gz linux-659a37844abc00c3dc676bb1faed29c1dacbf59f.tar.bz2 linux-659a37844abc00c3dc676bb1faed29c1dacbf59f.zip |
scsi: bsg-lib: Fix commands without data transfer in bsg_transport_sg_io_fn()
Set ret to 0 after the initial permission checks to avoid leaking -EPERM
for commands without data transfer.
Link: https://lore.kernel.org/r/20210731074027.1185545-3-hch@lst.de
Fixes: 75ca56409e5b ("scsi: bsg: Move the whole request execution into the SCSI/transport handlers")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'block/bsg-lib.c')
-rw-r--r-- | block/bsg-lib.c | 1 |
1 files changed, 1 insertions, 0 deletions
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); |