linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] megaraid: add scsi_cmnd NULL check before use
@ 2016-05-08  0:40 Petros Koutoupis
  2016-05-08  3:32 ` Finn Thain
  0 siblings, 1 reply; 20+ messages in thread
From: Petros Koutoupis @ 2016-05-08  0:40 UTC (permalink / raw)
  To: kashyap.desai, sumit.saxena, uday.lingala; +Cc: megaraidlinux.pdl, linux-scsi

The current state of the code checks to see if the reference to scsi_cmnd is
not null, but it never checks to see if it is null and always assumes it is valid
before its use in below switch statement. This patch addresses that.

--- linux/drivers/scsi/megaraid/megaraid_sas_fusion.c.orig	2016-05-07 09:12:56.748969851 -0500
+++ linux/drivers/scsi/megaraid/megaraid_sas_fusion.c	2016-05-07 09:15:29.612967113 -0500
@@ -2277,6 +2277,10 @@ complete_cmd_fusion(struct megasas_insta
 
 		if (cmd_fusion->scmd)
 			cmd_fusion->scmd->SCp.ptr = NULL;
+		else if ((!cmd_fusion->scmd) &&
+			 ((scsi_io_req->Function == MPI2_FUNCTION_SCSI_IO_REQUEST) ||
+			 (scsi_io_req->Function == MEGASAS_MPI2_FUNCTION_LD_IO_REQUEST)))
+			goto next;
 
 		scmd_local = cmd_fusion->scmd;
 		status = scsi_io_req->RaidContext.status;
@@ -2336,7 +2340,7 @@ complete_cmd_fusion(struct megasas_insta
 				megasas_complete_cmd(instance, cmd_mfi, DID_OK);
 			break;
 		}
-
+next:
 		fusion->last_reply_idx[MSIxIndex]++;
 		if (fusion->last_reply_idx[MSIxIndex] >=
 		    fusion->reply_q_depth)



^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2016-05-13 23:34 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-08  0:40 [PATCH] megaraid: add scsi_cmnd NULL check before use Petros Koutoupis
2016-05-08  3:32 ` Finn Thain
2016-05-08 12:08   ` Petros Koutoupis
2016-05-08 12:22     ` Finn Thain
2016-05-08 16:34       ` Petros Koutoupis
2016-05-09  1:35         ` Julian Calaby
2016-05-09  2:59           ` Petros Koutoupis
2016-05-09  8:05   ` Dan Carpenter
2016-05-09  9:43     ` Dan Carpenter
2016-05-09  9:48     ` Sumit Saxena
2016-05-09 19:29       ` Dan Carpenter
2016-05-09 21:28       ` Petros Koutoupis
2016-05-11  9:41         ` Sumit Saxena
2016-05-12  1:49           ` Petros Koutoupis
2016-05-12  6:35             ` Dan Carpenter
2016-05-12 12:35               ` Sumit Saxena
2016-05-13  7:43                 ` Finn Thain
2016-05-13  7:43                   ` Sumit Saxena
2016-05-13  9:25                     ` Finn Thain
2016-05-13 23:34               ` Petros Koutoupis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).