Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-10]: src/sys/dev/usb Pull up following revision(s) (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/9657afea978a
branches:  netbsd-10
changeset: 373010:9657afea978a
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Jan 12 12:09:18 2023 +0000

description:
Pull up following revision(s) (requested by mrg in ticket #43):

        sys/dev/usb/ukbd.c: revision 1.162

ukbd(4): remember how much of attach worked so detach works.

if ukbd_attach() fails it means it has only really done the pmf
setup, nothing else, so avoid trying to remove callouts, child
devices, or console setup, usb task and uhidev operations.
fixes the crash (but not the underlying ukbd doesn't work issue)
seen in PR#57149.

diffstat:

 sys/dev/usb/ukbd.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (56 lines):

diff -r 4253e2c2fe71 -r 9657afea978a sys/dev/usb/ukbd.c
--- a/sys/dev/usb/ukbd.c        Thu Jan 12 12:07:23 2023 +0000
+++ b/sys/dev/usb/ukbd.c        Thu Jan 12 12:09:18 2023 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: ukbd.c,v 1.161 2022/04/06 21:51:29 mlelstv Exp $        */
+/*      $NetBSD: ukbd.c,v 1.161.4.1 2023/01/12 12:09:18 martin Exp $        */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.161 2022/04/06 21:51:29 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.161.4.1 2023/01/12 12:09:18 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -294,7 +294,8 @@
        int sc_npollchar;
        uint16_t sc_pollchars[MAXKEYS];
 
-       u_char sc_dying;
+       bool sc_dying;
+       bool sc_attached;
 };
 
 #ifdef UKBD_DEBUG
@@ -520,6 +521,8 @@
 
        sc->sc_wskbddev = config_found(self, &a, wskbddevprint, CFARGS_NONE);
 
+       sc->sc_attached = true;
+
        return;
 }
 
@@ -567,7 +570,7 @@
 
        switch (act) {
        case DVACT_DEACTIVATE:
-               sc->sc_dying = 1;
+               sc->sc_dying = true;
                return 0;
        default:
                return EOPNOTSUPP;
@@ -584,6 +587,9 @@
 
        pmf_device_deregister(self);
 
+       if (!sc->sc_attached)
+               return rv;
+
        if (sc->sc_console_keyboard) {
                /*
                 * Disconnect our consops and set ukbd_is_console



Home | Main Index | Thread Index | Old Index