[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2nn8276r-50nq-5655-o1r2-o610sp1s69q6@xreary.bet>
Date: Sat, 10 Jan 2026 10:00:03 +0100 (CET)
From: Jiri Kosina <jikos@...nel.org>
To: Haotian Zhang <vulab@...as.ac.cn>
cc: roderick.colenbrander@...y.com, bentiss@...nel.org,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] HID: playstation: Add missing check for
input_ff_create_memless
On Mon, 17 Nov 2025, Haotian Zhang wrote:
> The ps_gamepad_create() function calls input_ff_create_memless()
> without verifying its return value, which can lead to incorrect
> behavior or potential crashes when FF effects are triggered.
>
> Add a check for the return value of input_ff_create_memless().
>
> Fixes: 51151098d7ab ("HID: playstation: add DualSense classic rumble support.")
> Signed-off-by: Haotian Zhang <vulab@...as.ac.cn>
> ---
> drivers/hid/hid-playstation.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
> index 63f6eb9030d1..aea8d6cf46a2 100644
> --- a/drivers/hid/hid-playstation.c
> +++ b/drivers/hid/hid-playstation.c
> @@ -769,7 +769,9 @@ ps_gamepad_create(struct hid_device *hdev,
> #if IS_ENABLED(CONFIG_PLAYSTATION_FF)
> if (play_effect) {
> input_set_capability(gamepad, EV_FF, FF_RUMBLE);
> - input_ff_create_memless(gamepad, NULL, play_effect);
> + ret = input_ff_create_memless(gamepad, NULL, play_effect);
> + if (ret)
> + return ERR_PTR(ret);
This particular change by itself is good, and I'll be queuing it in
hid.git#for-6.19/upstrram-fixes.
While reviewing it though, I came across the fact that just one line
below, if input_register_device() fails, I believe we're leaking the
already allocated struct input_dev.
I'll send out a separate patch for it.
--
Jiri Kosina
SUSE Labs
Powered by blists - more mailing lists