target: Fix reference leak in target_get_sess_cmd() error path
authorBart Van Assche <bart.vanassche@sandisk.com>
Wed, 18 Feb 2015 14:33:58 +0000 (15:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Mar 2015 14:01:01 +0000 (15:01 +0100)
commit99360ec83ed2fe8046c09e0fcb5eafcfe9d9e86d
tree3ea03b656231335cbcc30d35ef53c11c259a8f26
parentd1d3eb6ce05ce9ff9b8d7bbe351a23ff8da96254
target: Fix reference leak in target_get_sess_cmd() error path

commit 7544e597343e2166daba3f32e4708533aa53c233 upstream.

This patch fixes a se_cmd->cmd_kref leak buf when se_sess->sess_tearing_down
is true within target_get_sess_cmd() submission path code.

This se_cmd reference leak can occur during active session shutdown when
ack_kref=1 is passed by target_submit_cmd_[map_sgls,tmr]() callers.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/target/target_core_transport.c