qla2xxx: Set the SCSI command result before calling the command done

This patch tries to address race condition between abort handler and
completion handler. When scsi command result is set by both abort and
completion handler, scsi_done() is only called after refcount on SRB
structure goes to zero. The abort handler sets this result prematurely even
when the refcount is non-zero value. Fix this by setting SCSI cmd->result
before scsi_done() is called.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8214 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2019-04-14 01:21:01 +00:00
parent 6093c63ba1
commit eb4388978e

View File

@@ -805,8 +805,6 @@ qla2x00_sp_compl(void *ptr, int res)
srb_t *sp = ptr;
struct scsi_cmnd *cmd = GET_CMD_SP(sp);
cmd->result = res;
if (WARN_ON(atomic_read(&sp->ref_count) == 0))
return;
@@ -814,6 +812,7 @@ qla2x00_sp_compl(void *ptr, int res)
return;
sp->free(sp);
cmd->result = res;
cmd->scsi_done(cmd);
}