Commit 0c0ac75f authored by Jens Axboe's avatar Jens Axboe Committed by Linus Torvalds

[PATCH] blk_execute_rq() oops on fast completion

blk_execute_rq() can oops in wait_for_completion(), if the request has
completed before we call wait_for_completion() because blk_end_sync_rq()
clears ->waiting when it is entered.  Fix this by always using the on-stack
completion variable instead.
Signed-off-by: default avatarJens Axboe <axboe@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d324f68b
...@@ -2210,7 +2210,7 @@ int blk_execute_rq(request_queue_t *q, struct gendisk *bd_disk, ...@@ -2210,7 +2210,7 @@ int blk_execute_rq(request_queue_t *q, struct gendisk *bd_disk,
rq->end_io = blk_end_sync_rq; rq->end_io = blk_end_sync_rq;
elv_add_request(q, rq, ELEVATOR_INSERT_BACK, 1); elv_add_request(q, rq, ELEVATOR_INSERT_BACK, 1);
generic_unplug_device(q); generic_unplug_device(q);
wait_for_completion(rq->waiting); wait_for_completion(&wait);
rq->waiting = NULL; rq->waiting = NULL;
if (rq->errors) if (rq->errors)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment