1
0
Fork 0
alistair23-linux/drivers
Ping Cheng 37309f47e2 HID: wacom: Fix memory leakage caused by kfifo_alloc
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>
2020-12-22 10:26:54 +01:00
..
accessibility speakup: fix uninitialized flush_lock 2020-12-09 15:38:13 +01:00
acpi ACPI updates for 5.11-rc1 2020-12-15 16:39:06 -08:00
amba
android Merge branch 'exec-for-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2020-12-15 19:29:43 -08:00
ata
atm
auxdisplay
base Power management updates for 5.11-rc1 2020-12-15 16:30:31 -08:00
bcma
block for-5.11/drivers-2020-12-14 2020-12-16 13:09:32 -08:00
bluetooth Bluetooth: btusb: Add workaround for remote-wakeup issues with Barrot 8041a02 fake CSR controllers 2020-12-07 17:01:54 +02:00
bus MIPS updates for v5.11: 2020-12-16 12:07:54 -08:00
cdrom cdrom: Reset sector_size back it is not 2048. 2020-12-12 11:12:25 -07:00
char Some very minor changes 2020-12-16 14:54:39 -08:00
clk Power management updates for 5.11-rc1 2020-12-15 16:30:31 -08:00
clocksource asm-generic: cross-architecture timer cleanup 2020-12-16 00:07:17 -08:00
connector
counter counter: microchip-tcb-capture: Fix CMR value check 2020-12-03 19:40:31 +00:00
cpufreq Merge branch 'pm-cpufreq' 2020-12-15 15:24:52 +01:00
cpuidle Power management updates for 5.11-rc1 2020-12-15 16:30:31 -08:00
crypto Networking updates for 5.11 2020-12-15 13:22:29 -08:00
dax vm_ops: rename .split() callback to .may_split() 2020-12-15 12:13:41 -08:00
dca
devfreq Merge branches 'pm-devfreq' and 'pm-tools' 2020-12-15 15:27:16 +01:00
dio
dma
dma-buf Merge branch 'akpm' (patches from Andrew) 2020-12-15 12:53:37 -08:00
edac Merge branch 'akpm' (patches from Andrew) 2020-12-15 12:53:37 -08:00
eisa
extcon extcon: max77693: Fix modalias string 2020-12-11 17:18:10 +09:00
firewire
firmware Power management updates for 5.11-rc1 2020-12-15 16:30:31 -08:00
fpga Merge 5.10-rc7 into char-misc-next 2020-12-07 10:08:14 +01:00
fsi hwmon patches for v5.11 2020-12-15 16:06:14 -08:00
gnss
gpio - New Drivers 2020-12-16 14:48:32 -08:00
gpu IOMMU updates for 5.11 2020-12-16 13:58:47 -08:00
greybus
hid HID: wacom: Fix memory leakage caused by kfifo_alloc 2020-12-22 10:26:54 +01:00
hsi
hv hyperv-next for 5.11 2020-12-16 11:49:46 -08:00
hwmon hwmon: (sbtsi) Add basic support for SB-TSI sensors 2020-12-12 08:32:35 -08:00
hwspinlock hwspinlock: sirf: Remove the redundant 'of_match_ptr' 2020-12-10 13:34:40 -06:00
hwtracing Char / Misc driver updates for 5.11-rc1 2020-12-15 14:10:09 -08:00
i2c Power management updates for 5.11-rc1 2020-12-15 16:30:31 -08:00
i3c
ide for-5.11/block-2020-12-14 2020-12-16 12:57:51 -08:00
idle intel_idle: Build fix 2020-12-03 10:00:23 +01:00
iio Staging / IIO driver patches for 5.11-rc1 2020-12-15 14:18:40 -08:00
infiniband RDMA 5.11 pull request 2020-12-16 13:42:26 -08:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2020-12-15 16:18:23 -08:00
interconnect interconnect changes for 5.11 2020-12-04 14:11:20 +01:00
iommu IOMMU updates for 5.11 2020-12-16 13:58:47 -08:00
ipack
irqchip irqchip/qcom-pdc: Fix phantom irq when changing between rising/falling 2020-12-12 10:46:02 +00:00
isdn
leds
lightnvm drivers/lightnvm: fix a null-ptr-deref bug in pblk-core.c 2020-12-08 10:02:45 -07:00
macintosh macintosh/adb-iop: Send correct poll command 2020-12-07 10:48:16 +01:00
mailbox
mcb
md for-5.11/drivers-2020-12-14 2020-12-16 13:09:32 -08:00
media Power management updates for 5.11-rc1 2020-12-15 16:30:31 -08:00
memory
memstick memstick: r592: Fix error return in r592_probe() 2020-12-04 12:27:10 +01:00
message SCSI misc on 20201216 2020-12-16 13:34:31 -08:00
mfd mfd: kempld-core: Add support for additional devices 2020-12-02 12:53:27 +00:00
misc drivers/misc/lkdtm/lkdtm.h: correct wrong filenames in comment 2020-12-15 22:46:16 -08:00
mmc MMC core: 2020-12-15 15:57:25 -08:00
most
mtd MTD core: 2020-12-16 14:58:35 -08:00
mux
net xen: branch for v5.11-rc1 2020-12-16 11:53:09 -08:00
nfc Networking updates for 5.11 2020-12-15 13:22:29 -08:00
ntb
nubus
nvdimm
nvme RDMA 5.11 pull request 2020-12-16 13:42:26 -08:00
nvmem
of Driver core updates for 5.11-rc1 2020-12-15 14:02:26 -08:00
opp Merge branch 'pm-cpufreq' 2020-12-15 15:24:52 +01:00
oprofile
parisc
parport
pci RDMA 5.11 pull request 2020-12-16 13:42:26 -08:00
pcmcia
perf perf/imx_ddr: Add system PMU identifier for userspace 2020-12-09 14:14:02 +00:00
phy Char / Misc driver updates for 5.11-rc1 2020-12-15 14:10:09 -08:00
pinctrl This is the bulk of pin control changes for the v5.11 kernel: 2020-12-16 15:02:49 -08:00
platform Merge tag 'thermal-v5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux 2020-12-15 16:21:37 -08:00
pnp
power
powercap Merge branches 'pm-sleep', 'pm-acpi', 'pm-domains' and 'powercap' 2020-12-15 15:26:14 +01:00
pps
ps3
ptp ptp: clockmatrix: deprecate firmware older than 4.8.7 2020-12-09 15:00:55 -08:00
pwm pwm: sl28cpld: fix getting driver data in pwm callbacks 2020-12-03 09:57:37 -08:00
rapidio rapidio: remove unused rio_get_asm() and rio_get_device() 2020-12-15 22:46:18 -08:00
ras
regulator Merge remote-tracking branch 'regulator/for-5.11' into regulator-next 2020-12-11 17:48:32 +00:00
remoteproc remoteproc/mediatek: read IPI buffer offset from FW 2020-12-10 13:32:10 -06:00
reset
rpmsg
rtc ntp: Make the RTC sync offset less obscure 2020-12-11 10:40:53 +01:00
s390 SCSI misc on 20201216 2020-12-16 13:34:31 -08:00
sbus
scsi SCSI misc on 20201216 2020-12-16 13:34:31 -08:00
sfi
sh
siox siox: Make remove callback return void 2020-12-10 16:17:15 +01:00
slimbus slimbus: qcom: fix potential NULL dereference in qcom_slim_prg_slew() 2020-12-10 16:23:56 +01:00
soc Power management updates for 5.11-rc1 2020-12-15 16:30:31 -08:00
soundwire soundwire: intel: fix another unused-function warning 2020-12-05 13:11:54 +05:30
spi Merge remote-tracking branch 'spi/for-5.11' into spi-next 2020-12-11 17:49:01 +00:00
spmi spmi: Add driver shutdown support 2020-12-10 10:45:36 +01:00
ssb
staging Staging / IIO driver patches for 5.11-rc1 2020-12-15 14:18:40 -08:00
target SCSI misc on 20201216 2020-12-16 13:34:31 -08:00
tc
tee Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2020-12-14 12:18:19 -08:00
thermal Merge tag 'thermal-v5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux 2020-12-15 16:21:37 -08:00
thunderbolt thunderbolt: Changes for v5.11 merge window 2020-12-08 13:41:45 +01:00
tty printk changes for 5.11 2020-12-16 10:45:11 -08:00
uio uio: uio_hv_generic: use devm_kzalloc() for private data alloc 2020-12-09 19:59:00 +01:00
usb for-5.11/block-2020-12-14 2020-12-16 12:57:51 -08:00
vdpa Merge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux 2020-12-07 18:36:21 -08:00
vfio vfio: platform: Switch to use platform_get_mem_or_io() 2020-12-10 16:31:46 +01:00
vhost vhost: vringh: use krealloc_array() 2020-12-15 12:13:37 -08:00
video - Bug Fixes 2020-12-16 14:52:37 -08:00
virt
virtio mm, page_poison: remove CONFIG_PAGE_POISONING_NO_SANITY 2020-12-15 12:13:46 -08:00
visorbus
vlynq
vme vme: switch from 'pci_' to 'dma_' API 2020-12-09 19:44:34 +01:00
w1
watchdog
xen xen: branch for v5.11-rc1 2020-12-16 11:53:09 -08:00
zorro
Kconfig
Makefile asm-generic: cross-architecture timer cleanup 2020-12-16 00:07:17 -08:00