linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] bsg: free the request before return error code
@ 2021-01-19 12:33 Pan Bian
  2021-01-20  9:52 ` Christoph Hellwig
  2021-01-25  4:36 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Pan Bian @ 2021-01-19 12:33 UTC (permalink / raw)
  To: FUJITA Tomonori, Jens Axboe, Martin K. Petersen
  Cc: linux-scsi, linux-block, linux-kernel, Pan Bian

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(-)

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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] bsg: free the request before return error code
  2021-01-19 12:33 [PATCH 1/1] bsg: free the request before return error code Pan Bian
@ 2021-01-20  9:52 ` Christoph Hellwig
  2021-01-25  4:36 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2021-01-20  9:52 UTC (permalink / raw)
  To: Pan Bian
  Cc: FUJITA Tomonori, Jens Axboe, Martin K. Petersen, linux-scsi,
	linux-block, linux-kernel

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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] bsg: free the request before return error code
  2021-01-19 12:33 [PATCH 1/1] bsg: free the request before return error code Pan Bian
  2021-01-20  9:52 ` Christoph Hellwig
@ 2021-01-25  4:36 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2021-01-25  4:36 UTC (permalink / raw)
  To: Pan Bian, FUJITA Tomonori, Martin K. Petersen
  Cc: linux-scsi, linux-block, linux-kernel

On 1/19/21 5:33 AM, Pan Bian wrote:
> Free the request rq before returning error code.

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-25  4:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19 12:33 [PATCH 1/1] bsg: free the request before return error code Pan Bian
2021-01-20  9:52 ` Christoph Hellwig
2021-01-25  4:36 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).