[PATCH] tgtd: fix leak of task_in_scsi flag

Ryusuke Konishi <[email protected]>
Newsgroups org.kernel.vger.stgt
Message-ID <[email protected]>
When target_mgmt_request() function receives unknown or unsupported
task management function code or task was already completed for
ABORT_TASK request, iscsi_tm_execute() and iser_tm_exec() functions
exit without clearing task_in_scsi flag even though scsi command is
not in processing.

This is because the current implementation of target_mgmt_request()
function returns -EINVAL or -EEXIST for the above cases and
iscsi_tm_execute() and iser_tm_exec() do not handle these return
codes.

This fixes the issue by changing the return value of
target_mgmt_request() to MGMT_REQ_FAILED for such cases.

Signed-off-by: Ryusuke Konishi <[email protected]>
---
 usr/target.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr/target.c b/usr/target.c
index b6f324c..0f3066b 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -1454,7 +1454,7 @@ enum mgmt_req_result target_mgmt_request(int tid, uint64_t itn_id,
 	}
 
 	if (err)
-		return err;
+		return MGMT_REQ_FAILED;
 	else if (send)
 		return MGMT_REQ_DONE;
 
-- 
1.7.9.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.