Browse Source

[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>
tags/v1.20.1
Michael Brown 7 years ago
parent
commit
6bc4a8ac91
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      src/drivers/block/scsi.c

+ 4
- 2
src/drivers/block/scsi.c View File

392
 		       scsidev, scsicmd->tag, strerror ( rc ) );
392
 		       scsidev, scsicmd->tag, strerror ( rc ) );
393
 	}
393
 	}
394
 
394
 
395
+	/* Remove from list of commands */
396
+	list_del ( &scsicmd->list );
397
+
395
 	/* Shut down interfaces */
398
 	/* Shut down interfaces */
396
 	intfs_shutdown ( rc, &scsicmd->scsi, &scsicmd->block, NULL );
399
 	intfs_shutdown ( rc, &scsicmd->scsi, &scsicmd->block, NULL );
397
 
400
 
398
-	/* Remove from list of commands and drop list's reference */
399
-	list_del ( &scsicmd->list );
401
+	/* Drop list's reference */
400
 	scsicmd_put ( scsicmd );
402
 	scsicmd_put ( scsicmd );
401
 }
403
 }
402
 
404
 

Loading…
Cancel
Save