public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: "Tomasz Pakuła" <tomasz.pakula.oficjalny@gmail.com>
Cc: jikos@kernel.org, bentiss@kernel.org, sashal@kernel.org,
	oleg@makarenk.ooo, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] HID: pidff: Fix condition effect bit clearing
Date: Wed, 4 Feb 2026 06:21:37 +0100	[thread overview]
Message-ID: <2026020430-evergreen-unsubtle-7c48@gregkh> (raw)
In-Reply-To: <20260203174241.2863219-1-tomasz.pakula.oficjalny@gmail.com>

On Tue, Feb 03, 2026 at 06:42:41PM +0100, Tomasz Pakuła wrote:
> 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
> 
> 

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

  reply	other threads:[~2026-02-04  5:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-03 17:42 [PATCH] HID: pidff: Fix condition effect bit clearing Tomasz Pakuła
2026-02-04  5:21 ` Greg KH [this message]
2026-02-04 11:58 ` Jiri Slaby
2026-02-04 12:58   ` Tomasz Pakuła

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2026020430-evergreen-unsubtle-7c48@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=bentiss@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@makarenk.ooo \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tomasz.pakula.oficjalny@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox