提交 d0905ca7 编写于 作者: A Andy Grover 提交者: Bart Van Assche

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

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: NBryant G Ly <bgly@us.ibm.com>
Tested-by: NBryant G Ly <bgly@us.ibm.com>
Signed-off-by: NAndy Grover <agrover@redhat.com>
Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
上级 8dcf07be
......@@ -686,8 +686,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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册