]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
UBUNTU: SAUCE: (no-up) target/user: Fix use-after-free of tcmu_cmds if they are expired
authorAndy Grover <agrover@redhat.com>
Thu, 8 Dec 2016 18:01:17 +0000 (11:01 -0700)
committerLuis Henriques <luis.henriques@canonical.com>
Mon, 19 Dec 2016 17:28:15 +0000 (17:28 +0000)
BugLink: http://bugs.launchpad.net/bugs/1646204
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.

Cc: stable@vger.kernel.org
Reported-by: Bryant G Ly <bgly@us.ibm.com>
Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/target/target_core_user.c

index 542db458354ee38ce6e20b04143a19e9a7882190..a59a390a2e96a1ac0801a6e62d2af90312e6c9d6 100644 (file)
@@ -662,8 +662,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;
 }