]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
target: Fix COMPARE_AND_WRITE caw_sem leak during se_cmd quiesce
authorJiang Yi <jiangyilism@gmail.com>
Sun, 25 Jun 2017 19:28:50 +0000 (12:28 -0700)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Fri, 11 Aug 2017 10:37:53 +0000 (12:37 +0200)
commit2168b249d980f8cd5274d6987dcc451eede43b70
tree84a94b30cf6a6fb3a9463d25ee682408f58f3b21
parent05473f2c591b96abab436592a0d337cab4deae57
target: Fix COMPARE_AND_WRITE caw_sem leak during se_cmd quiesce

BugLink: http://bugs.launchpad.net/bugs/1707233
commit 1d6ef276594a781686058802996e09c8550fd767 upstream.

This patch addresses a COMPARE_AND_WRITE se_device->caw_sem leak,
that would be triggered during normal se_cmd shutdown or abort
via __transport_wait_for_tasks().

This would occur because target_complete_cmd() would catch this
early and do complete_all(&cmd->t_transport_stop_comp), but since
target_complete_ok_work() or target_complete_failure_work() are
never called to invoke se_cmd->transport_complete_callback(),
the COMPARE_AND_WRITE specific callbacks never release caw_sem.

To address this special case, go ahead and release caw_sem
directly from target_complete_cmd().

(Remove '&& success' from check, to release caw_sem regardless
 of scsi_status - nab)

Signed-off-by: Jiang Yi <jiangyilism@gmail.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
drivers/target/target_core_transport.c