summaryrefslogtreecommitdiff
path: root/sys/scsi/sd.c
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2010-09-08 15:16:23 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2010-09-08 15:16:23 +0000
commit063786806908e37736b99d757eb1cd58eca3a538 (patch)
tree8188b1653bbe2ce7ac15fd0f5651111a46ecd808 /sys/scsi/sd.c
parent98e3d75e2552c7f1eb522392907416b68fadecfa (diff)
Introduce a disk_lookup() function which calls device_lookup(), before
verifying that the resulting device is present on the disklist. This avoids a race whereby the disk driver can be accessed as soon as the softc has been allocated, but before the disk has completed initialisation and has called disk_attach() (up until this point dk_label is still a null pointer). Cut cd(4), sd(4) and wd(4) across to disk_lookup(). All callers of disk_attach() need to be tested and cut over in due course. ok deraadt@ krw@
Diffstat (limited to 'sys/scsi/sd.c')
-rw-r--r--sys/scsi/sd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 298aa71bc1a..fe08b311008 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.210 2010/09/08 14:47:12 jsing Exp $ */
+/* $OpenBSD: sd.c,v 1.211 2010/09/08 15:16:22 jsing Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -128,7 +128,7 @@ const struct scsi_inquiry_pattern sd_patterns[] = {
#define sdlock(softc) disk_lock(&(softc)->sc_dk)
#define sdunlock(softc) disk_unlock(&(softc)->sc_dk)
-#define sdlookup(unit) (struct sd_softc *)device_lookup(&sd_cd, (unit))
+#define sdlookup(unit) (struct sd_softc *)disk_lookup(&sd_cd, (unit))
int
sdmatch(struct device *parent, void *match, void *aux)