Skip to contentSkip to conversation

Patch "dm: fix rq_end_stats() NULL pointer in dm_requeue_original_request()" has been added to the 4.5-stable tree

PATCH [email protected] 1 participant 1 message Apr 9, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

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

to the 4.5-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
dm-fix-rq_end_stats-null-pointer-in-dm_requeue_original_request.patch
and it can be found in the queue-4.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 98dbc9c6c61698792e3a66f32f3bf066201d42d7 Mon Sep 17 00:00:00 2001

From: "Bryn M. Reeves" <[email protected]>
Date: Mon, 14 Mar 2016 17:04:34 -0400
Subject: dm: fix rq_end_stats() NULL pointer in dm_requeue_original_request()

From: Bryn M. Reeves <[email protected]>

commit 98dbc9c6c61698792e3a66f32f3bf066201d42d7 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()

Fixes e262f34741 ("dm stats: add support for request-based DM devices")
---
 drivers/md/dm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm.c +1 -1
@@ -1210,9 +1210,9 @@ static void dm_requeue_original_request(
 {
 	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 {

Patches currently in stable-queue which might be from [email protected] are

queue-4.5/dm-fix-rq_end_stats-null-pointer-in-dm_requeue_original_request.patch