VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
author: Pan Bian <bianpan2016@163.com> 2021-01-19 04:33:11 -0800 committer: Jens Axboe <axboe@kernel.dk> 2021-01-24 21:36:41 -0700 commit: 0f7b4bc6bb1e57c48ef14f1818df947c1612b206 parent: faa8e2c4fb30f336a289e3cbaa1e9a9dfd92ac8c
Commit Summary:
bsg: free the request before return error code
Diffstat:
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)