From 73b21174b228add00e49de2a01b94a2fbaa8b130 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 16 May 2012 10:50:56 +0100 Subject: [PATCH] [iscsi] Report SCSI response only when applicable 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 Tested-by: Brendon Walsh Signed-off-by: Michael Brown --- src/net/tcp/iscsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c index 9eaf3cc5..457ea731 100644 --- a/src/net/tcp/iscsi.c +++ b/src/net/tcp/iscsi.c @@ -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