diff options
author | Pan Bian <bianpan2016@163.com> | 2021-01-19 15:33:11 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-04 12:26:22 +0300 |
commit | ed0b50cd4407c001f1498952a714c386d360754e (patch) | |
tree | c595ae98b7159a22a43e95faffe28470ef26afcd /block | |
parent | de9b26b5133fdfd34b15296a0b75516cbb2314bf (diff) | |
download | linux-ed0b50cd4407c001f1498952a714c386d360754e.tar.xz |
bsg: free the request before return error code
[ Upstream commit 0f7b4bc6bb1e57c48ef14f1818df947c1612b206 ]
Free the request rq before returning error code.
Fixes: 972248e9111e ("scsi: bsg-lib: handle bidi requests without block layer help")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'block')
-rw-r--r-- | block/bsg.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/block/bsg.c b/block/bsg.c index 833c44b3d458..0d012efef527 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -157,8 +157,10 @@ static int bsg_sg_io(struct request_queue *q, fmode_t mode, void __user *uarg) return PTR_ERR(rq); ret = q->bsg_dev.ops->fill_hdr(rq, &hdr, mode); - if (ret) + if (ret) { + blk_put_request(rq); return ret; + } rq->timeout = msecs_to_jiffies(hdr.timeout); if (!rq->timeout) |