summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Han <hanchunchao@inspur.com>2024-11-15 09:26:21 +0300
committerJiri Kosina <jkosina@suse.com>2025-02-04 00:48:54 +0300
commit9b8e2220d3a052a690b1d1b23019673e612494c5 (patch)
tree3515528b514815f257affd675c7b2cba01acbc6b
parent45ab5166a82d038c898985b0ad43ead69c1f9573 (diff)
downloadlinux-9b8e2220d3a052a690b1d1b23019673e612494c5.tar.xz
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>
-rw-r--r--drivers/hid/hid-multitouch.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 82900857bfd8..e50887a6d22c 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -1679,9 +1679,12 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
break;
}
- if (suffix)
+ if (suffix) {
hi->input->name = devm_kasprintf(&hdev->dev, GFP_KERNEL,
"%s %s", hdev->name, suffix);
+ if (!hi->input->name)
+ return -ENOMEM;
+ }
return 0;
}