Re: [PATCH] HID: playstation: Add missing check for input_ff_create_memless
From: Jiri Kosina
Date: Wed Nov 26 2025 - 10:24:02 EST
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@xxxxxxxxxxx>
> ---
> 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