diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2009-09-16 15:45:00 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2009-09-16 15:45:00 +0000 |
commit | adcc48324f132718e5beedcadf4140c8f0fe408c (patch) | |
tree | f9afdec6325362cb24a2a7fc7ef6de31484fd22a /sys/dev/usb | |
parent | d9a7accea8ae216d24bde426a21e5bcd6910de3c (diff) |
fix ENETRESET handling in run_ioctl() and run_media_change().
fixes a kernel panic reported by ckuethe@ on amd64
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/if_run.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/dev/usb/if_run.c b/sys/dev/usb/if_run.c index dc01cf714a7..af88d5f8558 100644 --- a/sys/dev/usb/if_run.c +++ b/sys/dev/usb/if_run.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_run.c,v 1.31 2009/08/10 17:27:03 damien Exp $ */ +/* $OpenBSD: if_run.c,v 1.32 2009/09/16 15:44:59 damien Exp $ */ /*- * Copyright (c) 2008,2009 Damien Bergamini <damien.bergamini@free.fr> @@ -1303,8 +1303,11 @@ run_media_change(struct ifnet *ifp) sc->fixed_ridx = ridx; } - if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) == (IFF_UP | IFF_RUNNING)) + if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) == + (IFF_UP | IFF_RUNNING)) { + run_stop(ifp, 0); run_init(ifp); + } return 0; } @@ -2197,8 +2200,7 @@ run_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCS80211CHANNEL: /* * This allows for fast channel switching in monitor mode - * (used by kismet). In IBSS mode, we must explicitly reset - * the interface to generate a new beacon frame. + * (used by kismet). */ error = ieee80211_ioctl(ifp, cmd, data); if (error == ENETRESET && @@ -2216,8 +2218,10 @@ run_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) if (error == ENETRESET) { if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) == - (IFF_UP | IFF_RUNNING)) + (IFF_UP | IFF_RUNNING)) { + run_stop(ifp, 0); run_init(ifp); + } error = 0; } |