public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm-mpath: Clear map_context pointer when requeuing
@ 2011-11-30 14:25 Hannes Reinecke
  2011-11-30 14:49 ` Mike Snitzer
  2011-12-05 14:15 ` [dm-devel] [PATCH] " Dave Wysochanski
  0 siblings, 2 replies; 9+ messages in thread
From: Hannes Reinecke @ 2011-11-30 14:25 UTC (permalink / raw)
  To: linux-scsi; +Cc: James Bottomley, Hannes Reinecke, Mike Snitzer

When requeing a request we should be clearing the map_context
pointer, otherwise we might access an invalid memory location.

Cc: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Tested-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
 drivers/md/dm-mpath.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 5e0090e..e6fad46 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -920,8 +920,10 @@ static int multipath_map(struct dm_target *ti, struct request *clone,
 	map_context->ptr = mpio;
 	clone->cmd_flags |= REQ_FAILFAST_TRANSPORT;
 	r = map_io(m, clone, mpio, 0);
-	if (r < 0 || r == DM_MAPIO_REQUEUE)
+	if (r < 0 || r == DM_MAPIO_REQUEUE) {
 		mempool_free(mpio, m->mpio_pool);
+		map_context->ptr = NULL;
+	}
 
 	return r;
 }
-- 
1.6.0.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-03-19 15:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-30 14:25 [PATCH] dm-mpath: Clear map_context pointer when requeuing Hannes Reinecke
2011-11-30 14:49 ` Mike Snitzer
2011-12-01  0:12   ` Jun'ichi Nomura
2011-12-02 16:19     ` Hannes Reinecke
2011-12-05 10:49       ` Jun'ichi Nomura
2011-12-05 16:23         ` Hannes Reinecke
2011-12-06  4:44           ` Jun'ichi Nomura
2012-03-19 15:00             ` [dm-devel] " Alasdair G Kergon
2011-12-05 14:15 ` [dm-devel] [PATCH] " Dave Wysochanski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox