Message ID | 20210119123311.108137-1-bianpan2016@163.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [1/1] bsg: free the request before return error code | expand |
On Tue, Jan 19, 2021 at 04:33:11AM -0800, Pan Bian wrote: > 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> Looks good, Reviewed-by: Christoph Hellwig <hch@lst.de>
On 1/19/21 5:33 AM, Pan Bian wrote:
> Free the request rq before returning error code.
Applied, thanks.
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)
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> --- block/bsg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)