aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-merge.c
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2009-03-24 07:35:07 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-03-26 06:01:23 -0400
commit1cd96c242a829d52f7a5ae98f554ca9775429685 (patch)
tree018d3ab9fa0d6e2bcd739483ac2693f6f71db96b /block/blk-merge.c
parentf028f3b2f987ebc61cef382ab7a5c449917b728e (diff)
block: WARN in __blk_put_request() for potential bio leak
Put a WARN_ON in __blk_put_request if it is about to leak bio(s). This is a serious bug that can happen in error handling code paths. For this to work I have fixed a couple of places in block/ where request->bio != NULL ownership was not honored. And a small cleanup at sg_io() while at it. Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/blk-merge.c')
-rw-r--r--block/blk-merge.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 5a244f05360f..e39cb24b7679 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -403,6 +403,8 @@ static int attempt_merge(struct request_queue *q, struct request *req,
403 if (blk_rq_cpu_valid(next)) 403 if (blk_rq_cpu_valid(next))
404 req->cpu = next->cpu; 404 req->cpu = next->cpu;
405 405
406 /* owner-ship of bio passed from next to req */
407 next->bio = NULL;
406 __blk_put_request(q, next); 408 __blk_put_request(q, next);
407 return 1; 409 return 1;
408} 410}