1
0
Fork 0

blk-mq: fix use-after-free of request

If accounting is on, we will do the IO completion accounting after
we have freed the request. Fix that by moving it sooner instead.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
hifive-unleashed-5.1
Ming Lei 2013-12-05 10:50:39 -07:00 committed by Jens Axboe
parent 959a35f13e
commit 0d11e6aca3
1 changed files with 2 additions and 2 deletions

View File

@ -312,12 +312,12 @@ void blk_mq_complete_request(struct request *rq, int error)
blk_account_io_completion(rq, bytes);
blk_account_io_done(rq);
if (rq->end_io)
rq->end_io(rq, error);
else
blk_mq_free_request(rq);
blk_account_io_done(rq);
}
void __blk_mq_end_io(struct request *rq, int error)