On Sat, Dec 17, 2022 at 02:32:03PM +0100, [email protected] wrote:
> While doing the following actions:
> 
> 1. Plugging this USB device:
> 
> ugen0 at uhub0 port 7 "INNO TECH USB to Serial" rev 1.10/0.02 addr 2
> 
> 2. Running (remotely via ssh)
> 
> tail -f /dev/ugen0.01
> 
> 3. Physically unplugging the USB device
> 
> [kernel notices ugen0 detached]
> 
> 4. ^C in the terminal attached to the `tail -f /dev/ugen0.01` of step 2
> 
> Panic occurs.
> 
> [...]
> 
> kernel: page fault trap, code x0 
> 
> Stopped at klist_remove_locked.0x53

This indicates that there was a stray knote that referred to the
detached device.

The following patch might help. Could you test it?

Index: dev/usb/ugen.c
===================================================================
RCS file: src/sys/dev/usb/ugen.c,v
retrieving revision 1.116
diff -u -p -r1.116 ugen.c
--- dev/usb/ugen.c      2 Jul 2022 08:50:42 -0000       1.116
+++ dev/usb/ugen.c      18 Dec 2022 11:42:26 -0000
@@ -474,6 +474,8 @@ ugen_do_close(struct ugen_softc *sc, int
                        free(sce->ibuf, M_USBDEV, sce->ibuflen);
                        sce->ibuf = NULL;
                }
+
+               klist_invalidate(&sce->rsel.si_note);
        }
        sc->sc_is_open[endpt] = 0;
 

Reply via email to