From: Hannes Reinecke <[email-masked]>

When requeuing a request, clear the unused map_context pointer to ensure we
can't later access an invalid memory location.

Cc: Mike Snitzer <[email-masked]>
Signed-off-by: Hannes Reinecke <[email-masked]>
Tested-by: Heiko Carstens <[email-masked]>
Acked-by: Mike Snitzer <[email-masked]>
Signed-off-by: Alasdair G Kergon <[email-masked]>

FIXME: Be consistent - all 4 mempool_frees should clear this?
---
drivers/md/dm-mpath.c |    4 +++-
 drivers/md/dm-mpath.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-3.3-rc7/drivers/md/dm-mpath.c
===================================================================
--- linux-3.3-rc7.orig/drivers/md/dm-mpath.c
+++ linux-3.3-rc7/drivers/md/dm-mpath.c
@@ -920,8 +920,10 @@ static int multipath_map(struct dm_targe
 	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) {
+		map_context->ptr = NULL;
 		mempool_free(mpio, m->mpio_pool);
+	}
 
 	return r;
 }