Skip to content

Commit 0f7b4bc

Browse files
SinkFinderaxboe
authored andcommitted
bsg: free the request before return error code
Free the request rq before returning error code. Fixes: 972248e ("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>
1 parent faa8e2c commit 0f7b4bc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

block/bsg.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,10 @@ static int bsg_sg_io(struct request_queue *q, fmode_t mode, void __user *uarg)
157157
return PTR_ERR(rq);
158158

159159
ret = q->bsg_dev.ops->fill_hdr(rq, &hdr, mode);
160-
if (ret)
160+
if (ret) {
161+
blk_put_request(rq);
161162
return ret;
163+
}
162164

163165
rq->timeout = msecs_to_jiffies(hdr.timeout);
164166
if (!rq->timeout)

0 commit comments

Comments
 (0)