diff options
author | Gerhard Roth <gerhard@cvs.openbsd.org> | 2018-09-10 17:00:46 +0000 |
---|---|---|
committer | Gerhard Roth <gerhard@cvs.openbsd.org> | 2018-09-10 17:00:46 +0000 |
commit | 5d5f50d48c23b415547500de4b65ecd65d2fa6f4 (patch) | |
tree | b4a431ce2bd8076e6002d0a1948f4ce8c27751b0 | |
parent | 790b3b5695b70d5800b77a2480b29f01b43145a9 (diff) |
Prevent a panic in umb(4) when roaming is diabled.
Found by beck@, tested and ok by bluhm@
-rw-r--r-- | sys/dev/usb/if_umb.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/dev/usb/if_umb.c b/sys/dev/usb/if_umb.c index 7fc04eb6113..e5a48292f30 100644 --- a/sys/dev/usb/if_umb.c +++ b/sys/dev/usb/if_umb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_umb.c,v 1.19 2018/04/30 19:07:44 tb Exp $ */ +/* $OpenBSD: if_umb.c,v 1.20 2018/09/10 17:00:45 gerhard Exp $ */ /* * Copyright (c) 2016 genua mbH @@ -905,13 +905,7 @@ umb_statechg_timeout(void *arg) { struct umb_softc *sc = arg; - if (sc->sc_info.regstate == MBIM_REGSTATE_ROAMING && !sc->sc_roaming) { - /* - * Query the registration state until we're with the home - * network again. - */ - umb_cmd(sc, MBIM_CID_REGISTER_STATE, MBIM_CMDOP_QRY, NULL, 0); - } else + if (sc->sc_info.regstate != MBIM_REGSTATE_ROAMING || sc->sc_roaming) printf("%s: state change timeout\n",DEVNAM(sc)); usb_add_task(sc->sc_udev, &sc->sc_umb_task); } @@ -944,6 +938,15 @@ umb_state_task(void *arg) int s; int state; + if (sc->sc_info.regstate == MBIM_REGSTATE_ROAMING && !sc->sc_roaming) { + /* + * Query the registration state until we're with the home + * network again. + */ + umb_cmd(sc, MBIM_CID_REGISTER_STATE, MBIM_CMDOP_QRY, NULL, 0); + return; + } + s = splnet(); if (ifp->if_flags & IFF_UP) umb_up(sc); |