Module Name: src Committed By: dyoung Date: Fri Jun 26 00:14:09 UTC 2009
Modified Files: src/sys/dev/usb: if_zyd.c Log Message: Compilable, untested fix to zyd(4) lossage reported by Matthias-Christian Ott: every ioctl but SIOCSIFFLAGS fails with ENXIO (Device not configured). Let ioctls complete even if initialization is not complete (!sc->attached). Do exit immediately from zyd_newstate with ENXIO if !sc->attached, however: zyd_newstate tries to call some USB routines for which it is probably not ready. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/usb/if_zyd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/usb/if_zyd.c diff -u src/sys/dev/usb/if_zyd.c:1.19 src/sys/dev/usb/if_zyd.c:1.20 --- src/sys/dev/usb/if_zyd.c:1.19 Fri Jun 26 00:06:27 2009 +++ src/sys/dev/usb/if_zyd.c Fri Jun 26 00:14:09 2009 @@ -1,5 +1,5 @@ /* $OpenBSD: if_zyd.c,v 1.52 2007/02/11 00:08:04 jsg Exp $ */ -/* $NetBSD: if_zyd.c,v 1.19 2009/06/26 00:06:27 dyoung Exp $ */ +/* $NetBSD: if_zyd.c,v 1.20 2009/06/26 00:14:09 dyoung Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini <damien.bergam...@free.fr> @@ -22,7 +22,7 @@ * ZyDAS ZD1211/ZD1211B USB WLAN driver. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.19 2009/06/26 00:06:27 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.20 2009/06/26 00:14:09 dyoung Exp $"); #include "bpfilter.h" @@ -784,6 +784,9 @@ { struct zyd_softc *sc = ic->ic_ifp->if_softc; + if (!sc->attached) + return ENXIO; + usb_rem_task(sc->sc_udev, &sc->sc_task); callout_stop(&sc->sc_scan_ch); callout_stop(&sc->sc_amrr_ch); @@ -2446,10 +2449,7 @@ break; default: - if (!sc->attached) - error = ENXIO; - else - error = ieee80211_ioctl(ic, cmd, data); + error = ieee80211_ioctl(ic, cmd, data); } if (error == ENETRESET) {