Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

HID: multitouch: Add NULL check in mt_input_configured

devm_kasprintf() can return a NULL pointer on failure,but this
returned value in mt_input_configured() is not checked.
Add NULL check in mt_input_configured(), to handle kernel NULL
pointer dereference error.

Fixes: 479439463529 ("HID: multitouch: Correct devm device reference for hidinput input_dev name")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>

authored by

Charles Han and committed by
Jiri Kosina
9b8e2220 45ab5166

+4 -1
+4 -1
drivers/hid/hid-multitouch.c
··· 1679 1679 break; 1680 1680 } 1681 1681 1682 - if (suffix) 1682 + if (suffix) { 1683 1683 hi->input->name = devm_kasprintf(&hdev->dev, GFP_KERNEL, 1684 1684 "%s %s", hdev->name, suffix); 1685 + if (!hi->input->name) 1686 + return -ENOMEM; 1687 + } 1685 1688 1686 1689 return 0; 1687 1690 }