diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2010-05-05 19:47:44 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2010-05-05 19:47:44 +0000 |
commit | 2e85a2efb80c63b968b1234cfe587ed2f5430c3a (patch) | |
tree | f63512260efcf11ed75c7fddb8a4cf0368107283 /sys/dev | |
parent | 818861e3ac35c51d884cc29da7326469ebda4042 (diff) |
Prevent a process from entering iwn_ioctl while another process is
tsleep'ing (for example waiting for the firmware to become alive)
in iwn_init.
I believe this might fix a crash reported by dhill@
This is a temporary fix until I find something better that I will
apply to my other drivers that can tsleep in if_init (wpi, run etc...)
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/if_iwn.c | 11 | ||||
-rw-r--r-- | sys/dev/pci/if_iwnvar.h | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c index d539fdae379..cc5a31635e1 100644 --- a/sys/dev/pci/if_iwn.c +++ b/sys/dev/pci/if_iwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwn.c,v 1.93 2010/05/05 19:41:57 damien Exp $ */ +/* $OpenBSD: if_iwn.c,v 1.94 2010/05/05 19:47:43 damien Exp $ */ /*- * Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr> @@ -3068,6 +3068,13 @@ iwn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) int s, error = 0; s = splnet(); + /* + * Prevent processes from entering this function while another + * process is tsleep'ing in it. + */ + if (sc->sc_flags & IWN_FLAG_BUSY) + return EBUSY; + sc->sc_flags |= IWN_FLAG_BUSY; switch (cmd) { case SIOCSIFADDR: @@ -3127,6 +3134,8 @@ iwn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = iwn_init(ifp); } } + + sc->sc_flags &= ~IWN_FLAG_BUSY; splx(s); return error; } diff --git a/sys/dev/pci/if_iwnvar.h b/sys/dev/pci/if_iwnvar.h index 827406c2784..03e7215b5e8 100644 --- a/sys/dev/pci/if_iwnvar.h +++ b/sys/dev/pci/if_iwnvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwnvar.h,v 1.18 2010/04/30 16:06:46 damien Exp $ */ +/* $OpenBSD: if_iwnvar.h,v 1.19 2010/05/05 19:47:43 damien Exp $ */ /*- * Copyright (c) 2007, 2008 @@ -207,6 +207,7 @@ struct iwn_softc { #define IWN_FLAG_CALIB_DONE (1 << 2) #define IWN_FLAG_USE_ICT (1 << 3) #define IWN_FLAG_INTERNAL_PA (1 << 4) +#define IWN_FLAG_BUSY (1 << 5) uint8_t hw_type; const struct iwn_hal *sc_hal; |