scsi: aic79xx: add scb NULL check in ahd_handle_msg_reject()
Subsystems (2)
PATCH 1/1 scsi: aic79xx: add scb NULL check in ahd_handle_msg_reject()
If ahd_lookup_scb() returns NULL and ahd_sent_msg() checks are false, then NULL pointer dereference happens
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by Aleksandr Aprelkov <[email protected]>
--- drivers/scsi/aic7xxx/aic79xx_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/aic7xxx/aic79xx_core.c +1 -1
@@ -5577,7 +5577,7 @@ ahd_handle_msg_reject(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)"Using asynchronous transfers\n" ,ahd_name (ahd), devinfo->channel, devinfo->target, devinfo->lun); - }else if ((scb->hscb->control &SIMPLE_QUEUE_TAG ) !=0 ) { + }else if (scb && (scb->hscb->control &SIMPLE_QUEUE_TAG ) !=0 ) {int tag_type;int mask;
Signature · 1 line
2.34.1
Quoted 16 lines · Aleksandr Aprelkov
If
ahd_lookup_scb()returns NULL andahd_sent_msg()checks are false, then NULL pointer dereference happensFound by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")Signed-off-by Aleksandr Aprelkov <[email protected]>--- drivers/scsi/aic7xxx/aic79xx_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/aic7xxx/aic79xx_core.c +0
-0
drivers/scsi/aic7xxx/aic79xx_core.c ahd_handle_msg_reject(struct ahd_softc *ahd, struct ahd_devinfo *devinfo) · line 5580
Quoted 5 lines
drivers/scsi/aic7xxx/aic79xx_core.c +1
-1@@ -5577,7 +5577,7 @@ ahd_handle_msg_reject(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)"Using asynchronous transfers\n" ,ahd_name (ahd), devinfo->channel, devinfo->target, devinfo->lun); - }else if ((scb->hscb->control &SIMPLE_QUEUE_TAG ) !=0 ) { + }else if (scb && (scb->hscb->control &SIMPLE_QUEUE_TAG ) !=0 ) {
"!= 0" is not needed.
Quoted 3 lines
drivers/scsi/aic7xxx/aic79xx_core.c +0
-0int tag_type;int mask;
Signature · 2 lines
Damien Le Moal Western Digital Research