git: 9front

Download patch

ref: 8987a843b3f898caeffb46f0595e33d193b5b910
parent: 090cecb89485191a3e80fa7370431cdde7fc0ed6
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Fri Feb 22 07:23:01 EST 2013

sdiahci: prevent nil pointer dereference on spurious interrupt status

on some controllers, we get bogus interrupt indication
for non present drives. ack the irq but ignore.

--- a/sys/src/9/pc/sdiahci.c
+++ b/sys/src/9/pc/sdiahci.c
@@ -1201,7 +1201,7 @@
 		cause &= ~m;
 		d = c->rawdrive + i;
 		ilock(d);
-		if(d->port->isr && c->hba->pi & m)
+		if(d->port != nil && d->port->isr && c->hba->pi & m)
 			updatedrive(d);
 		c->hba->isr = m;
 		iunlock(d);
--