[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210119123311.108137-1-bianpan2016@163.com>
Date: Tue, 19 Jan 2021 04:33:11 -0800
From: Pan Bian <bianpan2016@....com>
To: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>,
Jens Axboe <axboe@...nel.dk>,
"Martin K. Petersen" <martin.petersen@...cle.com>
Cc: linux-scsi@...r.kernel.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, Pan Bian <bianpan2016@....com>
Subject: [PATCH 1/1] bsg: free the request before return error code
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@....com>
---
block/bsg.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/block/bsg.c b/block/bsg.c
index d7bae94b64d9..3d78e843a83f 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)
--
2.17.1
Powered by blists - more mailing lists