Skip to contentSkip to conversation

Patch "target/user: Fix use-after-free of tcmu_cmds if they are expired" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jan 6, 2017

Subsystems (3)
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

target/user: Fix use-after-free of tcmu_cmds if they are expired

to the 4.9-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:
target-user-fix-use-after-free-of-tcmu_cmds-if-they-are-expired.patch
and it can be found in the queue-4.9 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 d0905ca757bc40bd1ebc261a448a521b064777d7 Mon Sep 17 00:00:00 2001

From: Andy Grover <[email protected]>
Date: Mon, 21 Nov 2016 16:35:30 -0800
Subject: target/user: Fix use-after-free of tcmu_cmds if they are expired

From: Andy Grover <[email protected]>

commit d0905ca757bc40bd1ebc261a448a521b064777d7 upstream.

Don't free the cmd in tcmu_check_expired_cmd, it's still referenced by an entry in our cmd_id->cmd idr. If userspace ever resumes processing, tcmu_handle_completions() will use the now-invalid cmd pointer.

Instead, don't free cmd. It will be freed by tcmu_handle_completion() if userspace ever recovers, or tcmu_free_device if not.

---
 drivers/target/target_core_user.c |    2 --
 1 file changed, 2 deletions(-)
drivers/target/target_core_user.c +0 -2
@@ -685,8 +685,6 @@ static int tcmu_check_expired_cmd(int id
 	target_complete_cmd(cmd->se_cmd, SAM_STAT_CHECK_CONDITION);
 	cmd->se_cmd = NULL;
 
-	kmem_cache_free(tcmu_cmd_cache, cmd);
-
 	return 0;
 }
 

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

queue-4.9/target-user-fix-use-after-free-of-tcmu_cmds-if-they-are-expired.patch