Ping Cheng
24e97d767a
HID: wacom: Fix memory leakage caused by kfifo_alloc
...
commit 37309f47e2f5674f3e86cb765312ace42cfcedf5 upstream.
As reported by syzbot below, kfifo_alloc'd memory would not be freed
if a non-zero return value is triggered in wacom_probe. This patch
creates and uses devm_kfifo_alloc to allocate and free itself.
BUG: memory leak
unreferenced object 0xffff88810dc44a00 (size 512):
comm "kworker/1:2", pid 3674, jiffies 4294943617 (age 14.100s)
hex dump (first 32 bytes):
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 00 ................
backtrace:
[<0000000023e1afac>] kmalloc_array include/linux/slab.h:592 [inline]
[<0000000023e1afac>] __kfifo_alloc+0xad/0x100 lib/kfifo.c:43
[<00000000c477f737>] wacom_probe+0x1a1/0x3b0 drivers/hid/wacom_sys.c:2727
[<00000000b3109aca>] hid_device_probe+0x16b/0x210 drivers/hid/hid-core.c:2281
[<00000000aff7c640>] really_probe+0x159/0x480 drivers/base/dd.c:554
[<00000000778d0bc3>] driver_probe_device+0x84/0x100 drivers/base/dd.c:738
[<000000005108dbb5>] __device_attach_driver+0xee/0x110 drivers/base/dd.c:844
[<00000000efb7c59e>] bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:431
[<0000000024ab1590>] __device_attach+0x122/0x250 drivers/base/dd.c:912
[<000000004c7ac048>] bus_probe_device+0xc6/0xe0 drivers/base/bus.c:491
[<00000000b93050a3>] device_add+0x5ac/0xc30 drivers/base/core.c:2936
[<00000000e5b46ea5>] hid_add_device+0x151/0x390 drivers/hid/hid-core.c:2437
[<00000000c6add147>] usbhid_probe+0x412/0x560 drivers/hid/usbhid/hid-core.c:1407
[<00000000c33acdb4>] usb_probe_interface+0x177/0x370 drivers/usb/core/driver.c:396
[<00000000aff7c640>] really_probe+0x159/0x480 drivers/base/dd.c:554
[<00000000778d0bc3>] driver_probe_device+0x84/0x100 drivers/base/dd.c:738
[<000000005108dbb5>] __device_attach_driver+0xee/0x110 drivers/base/dd.c:844
https://syzkaller.appspot.com/bug?extid=5b49c9695968d7250a26
Reported-by: syzbot+5b49c9695968d7250a26@syzkaller.appspotmail.com
Signed-off-by: Ping Cheng <ping.cheng@wacom.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-17 14:04:21 +01:00
..
2020-12-30 11:25:48 +01:00
2019-12-05 09:20:24 +01:00
2020-09-03 11:24:31 +02:00
2019-08-29 08:28:40 +02:00
2017-03-21 15:03:55 +01:00
2020-07-29 10:16:51 +02:00
2020-07-29 10:16:52 +02:00
2017-11-21 15:57:07 -08:00
2018-04-05 13:28:46 +02:00
2019-11-06 13:06:18 +01:00
2017-06-08 13:47:52 +02:00
2020-09-09 19:04:22 +02:00
2018-02-16 13:38:16 +01:00
2018-07-23 11:35:05 +02:00
2019-09-10 10:33:49 +01:00
2020-12-02 08:48:08 +01:00
2019-05-08 07:21:45 +02:00
2019-11-06 13:06:18 +01:00
2020-09-17 13:45:25 +02:00
2018-03-06 15:15:47 +01:00
2017-11-24 14:40:23 +01:00
2019-11-06 13:06:18 +01:00
2019-11-06 13:06:18 +01:00
2018-04-26 14:17:31 +02:00
2018-04-26 14:17:31 +02:00
2020-03-20 11:55:59 +01:00
2019-08-25 10:47:48 +02:00
2019-11-06 13:06:18 +01:00
2019-11-06 13:05:46 +01:00
2020-12-02 08:48:09 +01:00
2020-12-02 08:48:09 +01:00
2020-03-05 16:42:18 +01:00
2017-11-21 12:54:58 +01:00
2017-02-27 18:43:47 -08:00
2016-10-10 10:47:03 +02:00
2019-02-12 19:47:19 +01:00
2019-11-06 13:06:18 +01:00
2019-11-06 13:06:18 +01:00
2019-11-06 13:06:18 +01:00
2017-11-02 11:10:55 +01:00
2019-10-01 08:26:01 +02:00
2017-11-02 11:10:55 +01:00
2019-11-06 13:06:18 +01:00
2017-04-06 14:36:36 +02:00
2020-01-04 19:12:59 +01:00
2020-07-22 09:32:08 +02:00
2017-01-11 22:12:44 +01:00
2018-07-17 15:33:47 +02:00
2020-09-09 19:04:22 +02:00
2017-03-06 13:16:33 +01:00
2018-06-25 15:16:11 +02:00
2017-07-24 17:38:21 +02:00
2017-08-20 10:02:48 -04:00
2017-03-24 15:45:04 +01:00
2018-06-12 16:19:22 -07:00
2018-05-16 11:06:40 +02:00
2019-10-01 08:26:01 +02:00
2020-12-02 08:48:09 +01:00
2018-06-25 15:23:40 +02:00
2017-06-22 14:44:11 +02:00
2020-01-04 19:13:00 +01:00
2020-10-29 09:55:09 +01:00
2018-01-23 15:46:58 +01:00
2018-02-11 14:34:03 -08:00
2018-08-30 10:58:44 +02:00
2018-12-05 19:32:13 +01:00
2020-12-02 08:48:08 +01:00
2020-06-07 13:17:53 +02:00
2020-07-29 10:16:52 +02:00
2019-11-06 13:06:18 +01:00
2018-03-23 15:44:57 +01:00
2016-11-15 14:23:17 +01:00
2018-06-25 15:26:06 +02:00
2018-06-25 15:26:06 +02:00
2018-06-25 15:26:06 +02:00
2017-03-24 15:43:03 +01:00
2019-11-06 13:06:18 +01:00
2020-01-17 19:46:55 +01:00
2018-07-23 11:35:05 +02:00
2018-07-23 11:35:05 +02:00
2020-01-17 19:46:55 +01:00
2021-01-17 14:04:21 +01:00
2020-11-05 11:08:50 +01:00
2019-07-26 09:14:27 +02:00
2019-11-12 19:20:38 +01:00