]> www.infradead.org Git - users/jedix/linux-maple.git/commit
target/user: Fix use-after-free of tcmu_cmds if they are expired
authorAndy Grover <agrover@redhat.com>
Tue, 22 Nov 2016 00:35:30 +0000 (16:35 -0800)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 23 Jun 2017 04:10:51 +0000 (21:10 -0700)
commit6a638313fec6f9a4a2a0a78139b7012185d84736
tree6b4feafdb2014ee4c6461581a7dd625298417dcd
parent16c15e3e454b654dbb5bc23c7c3b06171146ccfb
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: 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>
Orabug: 25395066
(cherry picked from commit d0905ca757bc40bd1ebc261a448a521b064777d7)
Signed-off-by: Kyle Fortin <kyle.fortin@oracle.com>
Reviewed-by: Shan Hai <shan.hai@oracle.com>
drivers/target/target_core_user.c