NetBSD-Bugs archive

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

Re: kern/59206: kernel NULL pointer dereference caused by wsmouse_mux_close()



The following reply was made to PR kern/59206; it has been noted by GNATS.

From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/59206: kernel NULL pointer dereference caused by
 wsmouse_mux_close()
Date: Sun, 23 Mar 2025 09:49:26 +0000 (UTC)

 Can you please try:
 
 ---START patch---
 diff -urN a/src/sys/dev/usb/uts.c b/src/sys/dev/usb/uts.c
 --- a/src/sys/dev/usb/uts.c	2023-05-10 00:12:44.000000000 +0000
 +++ b/src/sys/dev/usb/uts.c	2025-03-23 09:42:51.560525820 +0000
 @@ -310,6 +310,7 @@
   uts_enable(void *v)
   {
   	struct uts_softc *sc = v;
 +	int error;
 
   	DPRINTFN(1,("uts_enable: sc=%p\n", sc));
 
 @@ -322,7 +323,11 @@
   	sc->sc_enabled = 1;
   	sc->sc_buttons = 0;
 
 -	return uhidev_open(sc->sc_hdev, &uts_intr, sc);
 +	error = uhidev_open(sc->sc_hdev, &uts_intr, sc);
 +	if (error)
 +		sc->sc_enabled = 0;
 +
 +	return error;
   }
 
   Static void
 @@ -338,8 +343,10 @@
   	}
   #endif
 
 -	sc->sc_enabled = 0;
 -	uhidev_close(sc->sc_hdev);
 +	if (sc->sc_enabled) {
 +		sc->sc_enabled = 0;
 +		uhidev_close(sc->sc_hdev);
 +	}
   }
 
   Static int
 @@ -370,6 +377,9 @@
   	uint32_t buttons = 0;
   	int flags, s;
 
 +	if (!sc->sc_enabled)
 +		return;
 +
   	DPRINTFN(5,("uts_intr: len=%d\n", len));
 
   	flags = WSMOUSE_INPUT_DELTA | WSMOUSE_INPUT_ABSOLUTE_Z;
 ---END patch---
 
 -RVP
 


Home | Main Index | Thread Index | Old Index