diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2021-12-21 09:30:32 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-12-21 09:30:32 -0800 |
commit | 1c3e979bf3e225e5b4b810b24712b16254d608b6 (patch) | |
tree | 956b3a0da3e4380bd724fbc91b9d5bf924086015 | |
parent | 6e0567b7305209c2d689ce57180a63d8dc657ad8 (diff) | |
parent | 13251ce1dd9bb525da2becb9b26fdfb94ca58659 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID fixes from Jiri Kosina:
- NULL pointer dereference fix in Vivaldi driver (Jiasheng Jiang)
- regression fix for device probing in Holtek driver (Benjamin
Tissoires)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
HID: potential dereference of null pointer
HID: holtek: fix mouse probing
-rw-r--r-- | drivers/hid/hid-holtek-mouse.c | 15 | ||||
-rw-r--r-- | drivers/hid/hid-vivaldi.c | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/drivers/hid/hid-holtek-mouse.c b/drivers/hid/hid-holtek-mouse.c index b7172c48ef9f..7c907939bfae 100644 --- a/drivers/hid/hid-holtek-mouse.c +++ b/drivers/hid/hid-holtek-mouse.c @@ -65,8 +65,23 @@ static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, static int holtek_mouse_probe(struct hid_device *hdev, const struct hid_device_id *id) { + int ret; + if (!hid_is_usb(hdev)) return -EINVAL; + + ret = hid_parse(hdev); + if (ret) { + hid_err(hdev, "hid parse failed: %d\n", ret); + return ret; + } + + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); + if (ret) { + hid_err(hdev, "hw start failed: %d\n", ret); + return ret; + } + return 0; } diff --git a/drivers/hid/hid-vivaldi.c b/drivers/hid/hid-vivaldi.c index cd7ada48b1d9..72957a9f7117 100644 --- a/drivers/hid/hid-vivaldi.c +++ b/drivers/hid/hid-vivaldi.c @@ -57,6 +57,9 @@ static int vivaldi_probe(struct hid_device *hdev, int ret; drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + hid_set_drvdata(hdev, drvdata); ret = hid_parse(hdev); |