]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
HID: playstation: Add missing check for input_ff_create_memless
authorHaotian Zhang <vulab@iscas.ac.cn>
Mon, 17 Nov 2025 08:28:08 +0000 (16:28 +0800)
committerJiri Kosina <jkosina@suse.com>
Sat, 10 Jan 2026 09:00:23 +0000 (10:00 +0100)
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@iscas.ac.cn>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
drivers/hid/hid-playstation.c

index e4dfcf26b04e74ce9e730679094ba14417462228..2ec6d4445e84babf1ce7c913cbec1fea689aabd2 100644 (file)
@@ -774,7 +774,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);
        }
 #endif