diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2015-02-18 15:33:58 +0100 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-03-19 23:26:31 -0700 |
commit | 7544e597343e2166daba3f32e4708533aa53c233 (patch) | |
tree | c3313d9f42ab0eeeca72de76d67283320444940a /drivers/target | |
parent | 2f450cc1fbe9713f79b217e61ab204e263723ead (diff) | |
download | op-kernel-dev-7544e597343e2166daba3f32e4708533aa53c233.zip op-kernel-dev-7544e597343e2166daba3f32e4708533aa53c233.tar.gz |
target: Fix reference leak in target_get_sess_cmd() error path
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>
Cc: <stable@vger.kernel.org> # 3.6+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_transport.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 0adc0f6..ac3cbab 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2389,6 +2389,10 @@ int target_get_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd, list_add_tail(&se_cmd->se_cmd_list, &se_sess->sess_cmd_list); out: spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); + + if (ret && ack_kref) + target_put_sess_cmd(se_sess, se_cmd); + return ret; } EXPORT_SYMBOL(target_get_sess_cmd); |