public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] HID: pidff: Fix condition effect bit clearing
@ 2026-02-03 17:42 Tomasz Pakuła
  2026-02-04  5:21 ` Greg KH
  2026-02-04 11:58 ` Jiri Slaby
  0 siblings, 2 replies; 4+ messages in thread
From: Tomasz Pakuła @ 2026-02-03 17:42 UTC (permalink / raw)
  To: jikos, bentiss, sashal
  Cc: oleg, linux-input, linux-kernel, stable, tomasz.pakula.oficjalny

As reported by MPDarkGuy on discord, NULL pointer dereferences were
happening because not all the conditional effects bits were cleared.

Properly clear all conditional effect bits from ffbit

Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
---

Urgent for 6.19 rc period and backports for 6.18

 drivers/hid/usbhid/hid-pidff.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c
index a4e700b40ba9..56d6af39ba81 100644
--- a/drivers/hid/usbhid/hid-pidff.c
+++ b/drivers/hid/usbhid/hid-pidff.c
@@ -1452,10 +1452,13 @@ static int pidff_init_fields(struct pidff_device *pidff, struct input_dev *dev)
 		hid_warn(pidff->hid, "unknown ramp effect layout\n");
 
 	if (PIDFF_FIND_FIELDS(set_condition, PID_SET_CONDITION, 1)) {
-		if (test_and_clear_bit(FF_SPRING, dev->ffbit)   ||
-		    test_and_clear_bit(FF_DAMPER, dev->ffbit)   ||
-		    test_and_clear_bit(FF_FRICTION, dev->ffbit) ||
-		    test_and_clear_bit(FF_INERTIA, dev->ffbit))
+		bool test = false;
+
+		test |= test_and_clear_bit(FF_SPRING, dev->ffbit);
+		test |= test_and_clear_bit(FF_DAMPER, dev->ffbit);
+		test |= test_and_clear_bit(FF_FRICTION, dev->ffbit);
+		test |= test_and_clear_bit(FF_INERTIA, dev->ffbit);
+		if (test)
 			hid_warn(pidff->hid, "unknown condition effect layout\n");
 	}
 
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-04 12:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-03 17:42 [PATCH] HID: pidff: Fix condition effect bit clearing Tomasz Pakuła
2026-02-04  5:21 ` Greg KH
2026-02-04 11:58 ` Jiri Slaby
2026-02-04 12:58   ` Tomasz Pakuła

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox