Skip to content

Commit 9b8e222

Browse files
Charles HanJiri Kosina
authored andcommitted
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: 4794394 ("HID: multitouch: Correct devm device reference for hidinput input_dev name") Signed-off-by: Charles Han <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 45ab516 commit 9b8e222

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/hid/hid-multitouch.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1679,9 +1679,12 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
16791679
break;
16801680
}
16811681

1682-
if (suffix)
1682+
if (suffix) {
16831683
hi->input->name = devm_kasprintf(&hdev->dev, GFP_KERNEL,
16841684
"%s %s", hdev->name, suffix);
1685+
if (!hi->input->name)
1686+
return -ENOMEM;
1687+
}
16851688

16861689
return 0;
16871690
}

0 commit comments

Comments
 (0)