Commit 86b57e72 authored by Bryn M. Reeves's avatar Bryn M. Reeves Committed by Kamal Mostafa

dm: fix rq_end_stats() NULL pointer in dm_requeue_original_request()

commit 98dbc9c6 upstream.

An "old" (.request_fn) DM 'struct request' stores a pointer to the
associated 'struct dm_rq_target_io' in rq->special.

dm_requeue_original_request(), previously named
dm_requeue_unmapped_original_request(), called dm_unprep_request() to
reset rq->special to NULL.  But rq_end_stats() would go on to hit a NULL
pointer deference because its call to tio_from_request() returned NULL.

Fix this by calling rq_end_stats() _before_ dm_unprep_request()
Signed-off-by: default avatarBryn M. Reeves <bmr@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Fixes: e262f347 ("dm stats: add support for request-based DM devices")
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent ea343b04
......@@ -1184,9 +1184,9 @@ static void dm_requeue_original_request(struct mapped_device *md,
{
int rw = rq_data_dir(rq);
rq_end_stats(md, rq);
dm_unprep_request(rq);
rq_end_stats(md, rq);
if (!rq->q->mq_ops)
old_requeue_request(rq);
else {
......
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