[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1q8728r5-s1r0-oqro-n251-631p198861n8@xreary.bet>
Date: Wed, 26 Nov 2025 16:23:59 +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);
I am not deeply versed in this particular driver's code, but don't you
leak input_dev allocated by ps_allocate_input_dev() here?
Thanks,
--
Jiri Kosina
SUSE Labs
Powered by blists - more mailing lists