diff options
author | Jason Gerecke <killertofu@gmail.com> | 2021-01-21 10:46:49 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-01-30 13:55:17 +0100 |
commit | a7f6d4ab44344d71a64028f1dbdfbb1e8781572b (patch) | |
tree | 10fa3a5a7a28566072d3706a5b0c601a1a9c106c /drivers/hid/wacom_wac.h | |
parent | e843e4f782582a10e5077b917948d1df943070f6 (diff) | |
download | kernel_replicant_linux-a7f6d4ab44344d71a64028f1dbdfbb1e8781572b.tar.gz kernel_replicant_linux-a7f6d4ab44344d71a64028f1dbdfbb1e8781572b.tar.bz2 kernel_replicant_linux-a7f6d4ab44344d71a64028f1dbdfbb1e8781572b.zip |
HID: wacom: Correct NULL dereference on AES pen proximity
commit 179e8e47c02a1950f1c556f2b854bdb2259078fb upstream.
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: 37309f47e2f5 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hid/wacom_wac.h')
-rw-r--r-- | drivers/hid/wacom_wac.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index da612b6e9c77..195910dd2154 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h @@ -342,7 +342,7 @@ struct wacom_wac { struct input_dev *pen_input; struct input_dev *touch_input; struct input_dev *pad_input; - struct kfifo_rec_ptr_2 pen_fifo; + struct kfifo_rec_ptr_2 *pen_fifo; int pid; int num_contacts_left; u8 bt_features; |