iscsi-target: Fix ABORT_TASK + connection reset iscsi_queue_req memory leak
authorNicholas Bellinger <nab@linux-iscsi.org>
Tue, 10 Jun 2014 04:03:54 +0000 (04:03 +0000)
committerJiri Slaby <jslaby@suse.cz>
Wed, 2 Jul 2014 10:06:31 +0000 (12:06 +0200)
commit18b0e46ab4670436bcef4df0807ade2ffa7901ce
treea907cca6700f67d30f7ed3e2b15ce5f81914dc37
parentab7f3e4697f12ad16c816fdb27e3e494809bad91
iscsi-target: Fix ABORT_TASK + connection reset iscsi_queue_req memory leak

commit bbc050488525e1ab1194c27355f63c66814385b8 upstream.

This patch fixes a iscsi_queue_req memory leak when ABORT_TASK response
has been queued by TFO->queue_tm_rsp() -> lio_queue_tm_rsp() after a
long standing I/O completes, but the connection has already reset and
waiting for cleanup to complete in iscsit_release_commands_from_conn()
-> transport_generic_free_cmd() -> transport_wait_for_tasks() code.

It moves iscsit_free_queue_reqs_for_conn() after the per-connection command
list has been released, so that the associated se_cmd tag can be completed +
released by target-core before freeing any remaining iscsi_queue_req memory
for the connection generated by lio_queue_tm_rsp().

Cc: Thomas Glanzmann <thomas@glanzmann.de>
Cc: Charalampos Pournaris <charpour@gmail.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/target/iscsi/iscsi_target.c