diff options
author | David Jeffery <djeffery@redhat.com> | 2022-03-11 13:43:59 -0500 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2022-03-15 14:01:28 -0400 |
commit | 733ab7e1b5d1041204c4ca7373f6e6f9d08e3283 (patch) | |
tree | ec31716096771578a1aec264f49e4ee79340276c /drivers/scsi/qlogicfas408.c | |
parent | 69ad4ef868c1fc7609daa235dfa46d28ba7a3ba3 (diff) | |
download | linux-rt-733ab7e1b5d1041204c4ca7373f6e6f9d08e3283.tar.gz |
scsi: fnic: Finish scsi_cmnd before dropping the spinlock
When aborting a SCSI command through fnic, there is a race with the fnic
interrupt handler which can result in the SCSI command and its request
being completed twice. If the interrupt handler claims the command by
setting CMD_SP to NULL first, the abort handler assumes the interrupt
handler has completed the command and returns SUCCESS, causing the request
for the scsi_cmnd to be re-queued.
But the interrupt handler may not have finished the command yet. After it
drops the spinlock protecting CMD_SP, it does memory cleanup before finally
calling scsi_done() to complete the scsi_cmnd. If the call to scsi_done
occurs after the abort handler finishes and re-queues the request, the
completion of the scsi_cmnd will advance and try to double complete a
request already queued for retry.
This patch fixes the issue by moving scsi_done() and any other use of
scsi_cmnd to before the spinlock is released by the interrupt handler.
Link: https://lore.kernel.org/r/20220311184359.2345319-1-djeffery@redhat.com
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: David Jeffery <djeffery@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/qlogicfas408.c')
0 files changed, 0 insertions, 0 deletions