mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
HID: multitouch: Add NULL check in mt_input_configured
[ Upstream commit 9b8e2220d3a052a690b1d1b23019673e612494c5 ]
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: 4794394635 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
457bdeffca
commit
4e7113f591
@@ -1668,9 +1668,12 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (suffix)
|
if (suffix) {
|
||||||
hi->input->name = devm_kasprintf(&hdev->dev, GFP_KERNEL,
|
hi->input->name = devm_kasprintf(&hdev->dev, GFP_KERNEL,
|
||||||
"%s %s", hdev->name, suffix);
|
"%s %s", hdev->name, suffix);
|
||||||
|
if (!hi->input->name)
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user