diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2015-02-18 15:33:58 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-26 15:01:01 +0100 |
commit | 99360ec83ed2fe8046c09e0fcb5eafcfe9d9e86d (patch) | |
tree | 3ea03b656231335cbcc30d35ef53c11c259a8f26 | |
parent | d1d3eb6ce05ce9ff9b8d7bbe351a23ff8da96254 (diff) | |
download | lwn-99360ec83ed2fe8046c09e0fcb5eafcfe9d9e86d.tar.gz lwn-99360ec83ed2fe8046c09e0fcb5eafcfe9d9e86d.zip |
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>
-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 dcc5daa0ff1c..daf0f6357bb3 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2222,6 +2222,10 @@ int target_get_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd, 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); |