OSDN Git Service

scsi: libiscsi: Hold back_lock when calling iscsi_complete_task
authorLee Duncan <lduncan@suse.com>
Mon, 25 Feb 2019 17:41:30 +0000 (09:41 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 8 Mar 2019 02:37:04 +0000 (21:37 -0500)
commita656183e6c58a3a4d818278afab522b30a17014c
treecbb8559e07d33ae4234aaae5196501af4e7e9e86
parentcf9efd5d92365696580a45e0351208eef0ea1562
scsi: libiscsi: Hold back_lock when calling iscsi_complete_task

If there is an error queueing an iscsi command in iscsi_queuecommand(), for
example if the transport fails to take the command in
sessuin->tt->xmit_task(), then the error path can call
iscsi_complete_task() without first aquiring the back_lock as
required. This can lead to things like ITT pool can get corrupt, resulting
in duplicate ITTs being sent out.

The solution is to hold the back_lock around iscsi_complete_task() calls,
and to add a little commenting to help others understand when back_lock
must be held.

Signed-off-by: Lee Duncan <lduncan@suse.com>
Acked-by: Chris Leech <cleech@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/libiscsi.c