summaryrefslogtreecommitdiffstats
path: root/src/drivers/block
diff options
context:
space:
mode:
authorMichael Brown2017-03-26 10:21:14 +0200
committerMichael Brown2017-03-26 10:29:18 +0200
commit6bc4a8ac918b2dc5a460b3d2032055d8f7a478ff (patch)
tree1c83dc72a70f4cbb86dc3fbbfb8d2a8d03cd9adf /src/drivers/block
parent[vxge] Fix use of stale I/O buffer on error path (diff)
downloadipxe-6bc4a8ac918b2dc5a460b3d2032055d8f7a478ff.tar.gz
ipxe-6bc4a8ac918b2dc5a460b3d2032055d8f7a478ff.tar.xz
ipxe-6bc4a8ac918b2dc5a460b3d2032055d8f7a478ff.zip
[scsi] Avoid duplicate call to scsicmd_close() on TEST UNIT READY failure
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>
Diffstat (limited to 'src/drivers/block')
-rw-r--r--src/drivers/block/scsi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/drivers/block/scsi.c b/src/drivers/block/scsi.c
index cb4bb94c..d51b5cfa 100644
--- a/src/drivers/block/scsi.c
+++ b/src/drivers/block/scsi.c
@@ -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 );
}