NetBSD-Bugs archive

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

re: kern/57149



the ukbd detach bug looks obvious to me.  can you try this patch?


.mrg.


Index: dev/usb/ukbd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/ukbd.c,v
retrieving revision 1.161
diff -p -u -r1.161 ukbd.c
--- dev/usb/ukbd.c	6 Apr 2022 21:51:29 -0000	1.161
+++ dev/usb/ukbd.c	9 Jan 2023 19:13:29 -0000
@@ -295,6 +295,7 @@ struct ukbd_softc {
 	uint16_t sc_pollchars[MAXKEYS];
 
 	u_char sc_dying;
+	u_char sc_attached;
 };
 
 #ifdef UKBD_DEBUG
@@ -520,6 +521,8 @@ ukbd_attach(device_t parent, device_t se
 
 	sc->sc_wskbddev = config_found(self, &a, wskbddevprint, CFARGS_NONE);
 
+	sc->sc_attached = true;
+
 	return;
 }
 
@@ -584,6 +587,9 @@ ukbd_detach(device_t self, int flags)
 
 	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