summaryrefslogtreecommitdiffstats
path: root/sys/dev/sdmmc
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2006-10-17 01:26:26 +0000
committerdlg <dlg@openbsd.org>2006-10-17 01:26:26 +0000
commit8975d726d59eaeb94939bebb9a7a9ff9fed35d81 (patch)
treec3a0845e8c6f6ed6b90f9eaa263368b61b85f814 /sys/dev/sdmmc
parentMore devices (re which tries to attach and pciide) (diff)
downloadwireguard-openbsd-8975d726d59eaeb94939bebb9a7a9ff9fed35d81.tar.xz
wireguard-openbsd-8975d726d59eaeb94939bebb9a7a9ff9fed35d81.zip
dont pass a copy of sdmmcs scsi_link struct on the stack to the midlayer.
it triggered a panic on detach of the scsibus when it tried to use the adapters scsi_link struct that was no longer there. issue found by and this fix tested by pedro@ ok krw@ looks right deraadt@
Diffstat (limited to 'sys/dev/sdmmc')
-rw-r--r--sys/dev/sdmmc/sdmmc_scsi.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/sys/dev/sdmmc/sdmmc_scsi.c b/sys/dev/sdmmc/sdmmc_scsi.c
index eeddc8c7d83..f33299b56e6 100644
--- a/sys/dev/sdmmc/sdmmc_scsi.c
+++ b/sys/dev/sdmmc/sdmmc_scsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdmmc_scsi.c,v 1.5 2006/08/23 16:34:56 pedro Exp $ */
+/* $OpenBSD: sdmmc_scsi.c,v 1.6 2006/10/17 01:26:26 dlg Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -97,7 +97,6 @@ sdmmc_scsi_attach(struct sdmmc_softc *sc)
{
struct sdmmc_scsi_softc *scbus;
struct sdmmc_function *sf;
- struct sdmmc_attach_args saa;
MALLOC(scbus, struct sdmmc_scsi_softc *,
sizeof *scbus, M_DEVBUF, M_WAITOK);
@@ -138,17 +137,8 @@ sdmmc_scsi_attach(struct sdmmc_softc *sc)
scbus->sc_link.openings = 1;
scbus->sc_link.adapter = &scbus->sc_adapter;
- bzero(&saa, sizeof saa);
- bcopy(&scbus->sc_link, &saa.scsi_link, sizeof saa.scsi_link);
-
- /*
- * Set saa.sf to something, so that SDIO drivers don't need a
- * special case to weed out memory cards.
- */
- saa.sf = sc->sc_fn0 != NULL ? sc->sc_fn0 :
- SIMPLEQ_FIRST(&sc->sf_head);
-
- scbus->sc_child = config_found(&sc->sc_dev, &saa, scsiprint);
+ scbus->sc_child = config_found(&sc->sc_dev, &scbus->sc_link,
+ scsiprint);
if (scbus->sc_child == NULL) {
printf("%s: can't attach scsibus\n", sc->sc_dev.dv_xname);
goto free_ccbs;