Re: [syzbot] [input?] [usb?] memory leak in dualshock4_get_calibration_data
From: Oliver Neukum
Date: Thu Nov 13 2025 - 02:23:45 EST
#syz test: upstream 24172e0d7990
On 13.11.25 05:38, syzbot wrote:
Hello,From 29d67f8aa4aed5d207ceff52ad9c5c675a438425 Mon Sep 17 00:00:00 2001
syzbot found the following issue on:
HEAD commit: 24172e0d7990 Merge tag 'arm64-fixes' of git://git.kernel.o..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12a44692580000
kernel config: https://syzkaller.appspot.com/x/.config?x=cb128cd5cb439809
dashboard link: https://syzkaller.appspot.com/bug?extid=4f5f81e1456a1f645bf8
compiler: gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1508c658580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1051897c580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ded911fa4408/disk-24172e0d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/a1f3e61cb784/vmlinux-24172e0d.xz
kernel image: https://storage.googleapis.com/syzbot-assets/b92fd0e25cb7/bzImage-24172e0d.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+4f5f81e1456a1f645bf8@xxxxxxxxxxxxxxxxxxxxxxxxx
BUG: memory leak
unreferenced object 0xffff8881192f9a40 (size 64):
comm "kworker/1:0", pid 23, jiffies 4294944710
hex dump (first 32 bytes):
02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace (crc c51b5d6b):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4983 [inline]
slab_alloc_node mm/slub.c:5288 [inline]
__kmalloc_cache_noprof+0x3a6/0x5b0 mm/slub.c:5766
kmalloc_noprof include/linux/slab.h:957 [inline]
kzalloc_noprof include/linux/slab.h:1094 [inline]
dualshock4_get_calibration_data+0x437/0x500 drivers/hid/hid-playstation.c:1919
dualshock4_create drivers/hid/hid-playstation.c:2747 [inline]
ps_probe drivers/hid/hid-playstation.c:2845 [inline]
ps_probe+0x747/0x17d0 drivers/hid/hid-playstation.c:2821
__hid_device_probe drivers/hid/hid-core.c:2775 [inline]
hid_device_probe+0x298/0x3b0 drivers/hid/hid-core.c:2812
call_driver_probe drivers/base/dd.c:581 [inline]
really_probe+0x12f/0x430 drivers/base/dd.c:659
__driver_probe_device+0xc3/0x1a0 drivers/base/dd.c:801
driver_probe_device+0x2a/0x120 drivers/base/dd.c:831
__device_attach_driver+0x10f/0x170 drivers/base/dd.c:959
bus_for_each_drv+0xcf/0x120 drivers/base/bus.c:462
__device_attach+0xf9/0x290 drivers/base/dd.c:1031
bus_probe_device+0xcd/0xe0 drivers/base/bus.c:537
device_add+0x983/0xc80 drivers/base/core.c:3689
hid_add_device+0x140/0x250 drivers/hid/hid-core.c:2951
usbhid_probe+0x5ed/0x950 drivers/hid/usbhid/hid-core.c:1435
usb_probe_interface+0x173/0x3f0 drivers/usb/core/driver.c:396
call_driver_probe drivers/base/dd.c:581 [inline]
really_probe+0x12f/0x430 drivers/base/dd.c:659
BUG: memory leak
unreferenced object 0xffff8881192e7740 (size 64):
comm "kworker/1:0", pid 23, jiffies 4294944884
hex dump (first 32 bytes):
02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace (crc c51b5d6b):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4983 [inline]
slab_alloc_node mm/slub.c:5288 [inline]
__kmalloc_cache_noprof+0x3a6/0x5b0 mm/slub.c:5766
kmalloc_noprof include/linux/slab.h:957 [inline]
kzalloc_noprof include/linux/slab.h:1094 [inline]
dualshock4_get_calibration_data+0x437/0x500 drivers/hid/hid-playstation.c:1919
dualshock4_create drivers/hid/hid-playstation.c:2747 [inline]
ps_probe drivers/hid/hid-playstation.c:2845 [inline]
ps_probe+0x747/0x17d0 drivers/hid/hid-playstation.c:2821
__hid_device_probe drivers/hid/hid-core.c:2775 [inline]
hid_device_probe+0x298/0x3b0 drivers/hid/hid-core.c:2812
call_driver_probe drivers/base/dd.c:581 [inline]
really_probe+0x12f/0x430 drivers/base/dd.c:659
__driver_probe_device+0xc3/0x1a0 drivers/base/dd.c:801
driver_probe_device+0x2a/0x120 drivers/base/dd.c:831
__device_attach_driver+0x10f/0x170 drivers/base/dd.c:959
bus_for_each_drv+0xcf/0x120 drivers/base/bus.c:462
__device_attach+0xf9/0x290 drivers/base/dd.c:1031
bus_probe_device+0xcd/0xe0 drivers/base/bus.c:537
device_add+0x983/0xc80 drivers/base/core.c:3689
hid_add_device+0x140/0x250 drivers/hid/hid-core.c:2951
usbhid_probe+0x5ed/0x950 drivers/hid/usbhid/hid-core.c:1435
usb_probe_interface+0x173/0x3f0 drivers/usb/core/driver.c:396
call_driver_probe drivers/base/dd.c:581 [inline]
really_probe+0x12f/0x430 drivers/base/dd.c:659
BUG: memory leak
unreferenced object 0xffff88812484e5c0 (size 64):
comm "kworker/0:0", pid 9, jiffies 4294945059
hex dump (first 32 bytes):
02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace (crc c51b5d6b):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4983 [inline]
slab_alloc_node mm/slub.c:5288 [inline]
__kmalloc_cache_noprof+0x3a6/0x5b0 mm/slub.c:5766
kmalloc_noprof include/linux/slab.h:957 [inline]
kzalloc_noprof include/linux/slab.h:1094 [inline]
dualshock4_get_calibration_data+0x437/0x500 drivers/hid/hid-playstation.c:1919
dualshock4_create drivers/hid/hid-playstation.c:2747 [inline]
ps_probe drivers/hid/hid-playstation.c:2845 [inline]
ps_probe+0x747/0x17d0 drivers/hid/hid-playstation.c:2821
__hid_device_probe drivers/hid/hid-core.c:2775 [inline]
hid_device_probe+0x298/0x3b0 drivers/hid/hid-core.c:2812
call_driver_probe drivers/base/dd.c:581 [inline]
really_probe+0x12f/0x430 drivers/base/dd.c:659
__driver_probe_device+0xc3/0x1a0 drivers/base/dd.c:801
driver_probe_device+0x2a/0x120 drivers/base/dd.c:831
__device_attach_driver+0x10f/0x170 drivers/base/dd.c:959
bus_for_each_drv+0xcf/0x120 drivers/base/bus.c:462
__device_attach+0xf9/0x290 drivers/base/dd.c:1031
bus_probe_device+0xcd/0xe0 drivers/base/bus.c:537
device_add+0x983/0xc80 drivers/base/core.c:3689
hid_add_device+0x140/0x250 drivers/hid/hid-core.c:2951
usbhid_probe+0x5ed/0x950 drivers/hid/usbhid/hid-core.c:1435
usb_probe_interface+0x173/0x3f0 drivers/usb/core/driver.c:396
call_driver_probe drivers/base/dd.c:581 [inline]
really_probe+0x12f/0x430 drivers/base/dd.c:659
connection error: failed to recv *flatrpc.ExecutorMessageRawT: EOF
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxx.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
From: Oliver Neukum <oneukum@xxxxxxxx>
Date: Thu, 13 Nov 2025 08:03:55 +0100
Subject: [PATCH] hid: hid-playstation: fix memleak in probe
Free the buffer if we bail out in the error case of
dualshock4_get_calibration_data()
Signed-off-by: Oliver Neukum <oneukum@xxxxxxxx>
---
drivers/hid/hid-playstation.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
index 63f6eb9030d1..128aa6abd10b 100644
--- a/drivers/hid/hid-playstation.c
+++ b/drivers/hid/hid-playstation.c
@@ -1942,6 +1942,7 @@ static int dualshock4_get_calibration_data(struct dualshock4 *ds4)
"Failed to retrieve DualShock4 calibration info: %d\n",
ret);
ret = -EILSEQ;
+ kfree(buf);
goto transfer_failed;
} else {
break;
@@ -1959,6 +1960,7 @@ static int dualshock4_get_calibration_data(struct dualshock4 *ds4)
if (ret) {
hid_warn(hdev, "Failed to retrieve DualShock4 calibration info: %d\n", ret);
+ kfree(buf);
goto transfer_failed;
}
}
--
2.51.1