]> git.baikalelectronics.ru Git - kernel.git/commit
HID: wacom: Correct NULL dereference on AES pen proximity
authorJason Gerecke <killertofu@gmail.com>
Thu, 21 Jan 2021 18:46:49 +0000 (10:46 -0800)
committerJiri Kosina <jkosina@suse.cz>
Tue, 26 Jan 2021 10:53:53 +0000 (11:53 +0100)
commite2a11b4feef3c968c10df896ff77f60b8e16e458
tree1e9f0cad76bf4e91db233051432417846ae6dcf4
parent62b3e941300628b198ea0b0a674b92470604c8b2
HID: wacom: Correct NULL dereference on AES pen proximity

The recent commit to fix a memory leak introduced an inadvertant NULL
pointer dereference. The `wacom_wac->pen_fifo` variable was never
intialized, resuling in a crash whenever functions tried to use it.
Since the FIFO is only used by AES pens (to buffer events from pen
proximity until the hardware reports the pen serial number) this would
have been easily overlooked without testing an AES device.

This patch converts `wacom_wac->pen_fifo` over to a pointer (since the
call to `devres_alloc` allocates memory for us) and ensures that we assign
it to point to the allocated and initalized `pen_fifo` before the function
returns.

Link: https://github.com/linuxwacom/input-wacom/issues/230
Fixes: d84612e57a8d ("HID: wacom: Fix memory leakage caused by kfifo_alloc")
CC: stable@vger.kernel.org # v4.19+
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Tested-by: Ping Cheng <ping.cheng@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/wacom_sys.c
drivers/hid/wacom_wac.h