Skip to content

Commit

Permalink
[iscsi] Report SCSI response only when applicable
Browse files Browse the repository at this point in the history
iSCSI generally includes a full SCSI response only when an error
occurs.  iscsi_scsi_done() currently passes the NULL response through
to scsi_response(), which ends up causing scsicmd_response() to
dereference a NULL pointer.

Fix by calling scsi_response() only if we have a non-NULL response.

Reported-by: Brendon Walsh <brendonwalsh@niamu.com>
Tested-by: Brendon Walsh <brendonwalsh@niamu.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed May 16, 2012
1 parent a33298d commit 73b2117
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/net/tcp/iscsi.c
Expand Up @@ -337,7 +337,8 @@ static void iscsi_scsi_done ( struct iscsi_session *iscsi, int rc,
iscsi->command = NULL;

/* Send SCSI response, if any */
scsi_response ( &iscsi->data, rsp );
if ( rsp )
scsi_response ( &iscsi->data, rsp );

/* Close SCSI command, if this is still the same command. (It
* is possible that the command interface has already been
Expand Down

0 comments on commit 73b2117

Please sign in to comment.