diff options
author | 2011-07-14 16:38:27 +0000 | |
---|---|---|
committer | 2011-07-14 16:38:27 +0000 | |
commit | 752a3392cca36ad97e777fea80f4887836f3a058 (patch) | |
tree | 22a860b73526c0193b2a2594b910ef1d4b4cba10 | |
parent | str is an optional argument to -t; if no argument is given, this (diff) | |
download | wireguard-openbsd-752a3392cca36ad97e777fea80f4887836f3a058.tar.xz wireguard-openbsd-752a3392cca36ad97e777fea80f4887836f3a058.zip |
We must not call xl_wol_power() from xl_stop(). If we do the device
can be set into D3 sleep state at the wrong time. Fixes lock-up issues
reported by Thomas Gerlach.
Also, the interface needs to be running for WOL to work, so set it up
from within xl_wol() if it's not running yet.
"you don't need an ok for this" deraadt
-rw-r--r-- | sys/dev/ic/xl.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c index d3631653e61..d7879ed8a5f 100644 --- a/sys/dev/ic/xl.c +++ b/sys/dev/ic/xl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xl.c,v 1.103 2011/07/08 18:56:47 stsp Exp $ */ +/* $OpenBSD: xl.c,v 1.104 2011/07/14 16:38:27 stsp Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -215,6 +215,9 @@ xl_activate(struct device *self, int act) xl_reset(sc); xl_stop(sc); } +#ifndef SMALL_KERNEL + xl_wol_power(sc); +#endif rv = config_activate_children(self, act); break; case DVACT_RESUME: @@ -2373,10 +2376,6 @@ xl_stop(struct xl_softc *sc) ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); xl_freetxrx(sc); - -#ifndef SMALL_KERNEL - xl_wol_power(sc); -#endif } #ifndef SMALL_KERNEL @@ -2708,6 +2707,8 @@ xl_wol(struct ifnet *ifp, int enable) XL_SEL_WIN(7); if (enable) { + if (!(ifp->if_flags & IFF_RUNNING)) + xl_init(sc); CSR_WRITE_2(sc, XL_W7_BM_PME, XL_BM_PME_MAGIC); sc->xl_flags |= XL_FLAG_WOL; } else { |