diff options
author | Andy Grover <agrover@redhat.com> | 2016-11-21 16:35:30 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-09 08:22:03 +0100 |
commit | e141d1a21e31e57728a6f72c377ae1d63558734f (patch) | |
tree | 0e7f2dfd7176629b58b2668145c017e80f427095 | |
parent | 29f3d1127c4b475ebbd631903ce69dea1d042277 (diff) | |
download | linux-stable-e141d1a21e31e57728a6f72c377ae1d63558734f.tar.gz linux-stable-e141d1a21e31e57728a6f72c377ae1d63558734f.tar.bz2 linux-stable-e141d1a21e31e57728a6f72c377ae1d63558734f.zip |
target/user: Fix use-after-free of tcmu_cmds if they are expired
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.
Reported-by: Bryant G Ly <bgly@us.ibm.com>
Tested-by: Bryant G Ly <bgly@us.ibm.com>
Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/target/target_core_user.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 62bf4fe5704a..b8a986c2c567 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -682,8 +682,6 @@ static int tcmu_check_expired_cmd(int id, void *p, void *data) target_complete_cmd(cmd->se_cmd, SAM_STAT_CHECK_CONDITION); cmd->se_cmd = NULL; - kmem_cache_free(tcmu_cmd_cache, cmd); - return 0; } |