Skip to content

Commit

Permalink
[scsi] Avoid duplicate call to scsicmd_close() on TEST UNIT READY fai…
Browse files Browse the repository at this point in the history
…lure

When the TEST UNIT READY command receives an error response, the
shutdown of the command's block data interface will result in
scsidev_ready() closing the SCSI device.  This will subsequently
result in a duplicate call to scsicmd_close(), leading to an assertion
failure when list_del() is called for the second time.

Fix by removing the command from the list of outstanding commands
before shutting down the command's interfaces.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Mar 26, 2017
1 parent c13bf52 commit 6bc4a8a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/drivers/block/scsi.c
Expand Up @@ -392,11 +392,13 @@ static void scsicmd_close ( struct scsi_command *scsicmd, int rc ) {
scsidev, scsicmd->tag, strerror ( rc ) );
}

/* Remove from list of commands */
list_del ( &scsicmd->list );

/* Shut down interfaces */
intfs_shutdown ( rc, &scsicmd->scsi, &scsicmd->block, NULL );

/* Remove from list of commands and drop list's reference */
list_del ( &scsicmd->list );
/* Drop list's reference */
scsicmd_put ( scsicmd );
}

Expand Down

0 comments on commit 6bc4a8a

Please sign in to comment.