Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 964f4cab authored by Alexandra Diupina's avatar Alexandra Diupina Committed by Greg Kroah-Hartman
Browse files

scsi: 53c700: Check that command slot is not NULL



commit 8366d1f1249a0d0bba41d0bd1298d63e5d34c7f7 upstream.

Add a check for the command slot value to avoid dereferencing a NULL
pointer.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Co-developed-by: default avatarVladimir Telezhnikov <vtelezhnikov@astralinux.ru>
Signed-off-by: default avatarVladimir Telezhnikov <vtelezhnikov@astralinux.ru>
Signed-off-by: default avatarAlexandra Diupina <adiupina@astralinux.ru>
Link: https://lore.kernel.org/r/20230728123521.18293-1-adiupina@astralinux.ru


Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 311db605
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1594,7 +1594,7 @@ NCR_700_intr(int irq, void *dev_id)
				printk("scsi%d (%d:%d) PHASE MISMATCH IN SEND MESSAGE %d remain, return %p[%04x], phase %s\n", host->host_no, pun, lun, count, (void *)temp, temp - hostdata->pScript, sbcl_to_string(NCR_700_readb(host, SBCL_REG)));
#endif
				resume_offset = hostdata->pScript + Ent_SendMessagePhaseMismatch;
			} else if(dsp >= to32bit(&slot->pSG[0].ins) &&
			} else if (slot && dsp >= to32bit(&slot->pSG[0].ins) &&
				  dsp <= to32bit(&slot->pSG[NCR_700_SG_SEGMENTS].ins)) {
				int data_transfer = NCR_700_readl(host, DBC_REG) & 0xffffff;
				int SGcount = (dsp - to32bit(&slot->pSG[0].ins))/sizeof(struct NCR_700_SG_List);