Skip to content

Commit 42d43c9

Browse files
committed
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 fixes in amd_sfh driver (Basavaraj Natikar, Evgeny Novikov) - data processing fix for hid-u2fzero (Andrej Shadura) - fix for out-of-bounds write in hid-betop (F.A.Sulaiman) - new device IDs / device-specific quirks * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: HID: amd_sfh: Fix potential NULL pointer dereference HID: u2fzero: ignore incomplete packets without data HID: amd_sfh: Fix potential NULL pointer dereference HID: wacom: Add new Intuos BT (CTL-4100WL/CTL-6100WL) device IDs HID: apple: Fix logical maximum and usage maximum of Magic Keyboard JIS HID: betop: fix slab-out-of-bounds Write in betop_probe
2 parents 5816b3e + 88a0404 commit 42d43c9

File tree

5 files changed

+32
-8
lines changed

5 files changed

+32
-8
lines changed

drivers/hid/amd-sfh-hid/amd_sfh_pcie.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,13 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
255255
if (!privdata->cl_data)
256256
return -ENOMEM;
257257

258-
rc = devm_add_action_or_reset(&pdev->dev, amd_mp2_pci_remove, privdata);
258+
mp2_select_ops(privdata);
259+
260+
rc = amd_sfh_hid_client_init(privdata);
259261
if (rc)
260262
return rc;
261263

262-
mp2_select_ops(privdata);
263-
264-
return amd_sfh_hid_client_init(privdata);
264+
return devm_add_action_or_reset(&pdev->dev, amd_mp2_pci_remove, privdata);
265265
}
266266

267267
static int __maybe_unused amd_mp2_pci_resume(struct device *dev)

drivers/hid/hid-apple.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,19 @@ static int apple_event(struct hid_device *hdev, struct hid_field *field,
336336

337337
/*
338338
* MacBook JIS keyboard has wrong logical maximum
339+
* Magic Keyboard JIS has wrong logical maximum
339340
*/
340341
static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc,
341342
unsigned int *rsize)
342343
{
343344
struct apple_sc *asc = hid_get_drvdata(hdev);
344345

346+
if(*rsize >=71 && rdesc[70] == 0x65 && rdesc[64] == 0x65) {
347+
hid_info(hdev,
348+
"fixing up Magic Keyboard JIS report descriptor\n");
349+
rdesc[64] = rdesc[70] = 0xe7;
350+
}
351+
345352
if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 &&
346353
rdesc[53] == 0x65 && rdesc[59] == 0x65) {
347354
hid_info(hdev,

drivers/hid/hid-betopff.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,22 @@ static int betopff_init(struct hid_device *hid)
5656
{
5757
struct betopff_device *betopff;
5858
struct hid_report *report;
59-
struct hid_input *hidinput =
60-
list_first_entry(&hid->inputs, struct hid_input, list);
59+
struct hid_input *hidinput;
6160
struct list_head *report_list =
6261
&hid->report_enum[HID_OUTPUT_REPORT].report_list;
63-
struct input_dev *dev = hidinput->input;
62+
struct input_dev *dev;
6463
int field_count = 0;
6564
int error;
6665
int i, j;
6766

67+
if (list_empty(&hid->inputs)) {
68+
hid_err(hid, "no inputs found\n");
69+
return -ENODEV;
70+
}
71+
72+
hidinput = list_first_entry(&hid->inputs, struct hid_input, list);
73+
dev = hidinput->input;
74+
6875
if (list_empty(report_list)) {
6976
hid_err(hid, "no output reports found\n");
7077
return -ENODEV;

drivers/hid/hid-u2fzero.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ static int u2fzero_rng_read(struct hwrng *rng, void *data,
198198
}
199199

200200
ret = u2fzero_recv(dev, &req, &resp);
201-
if (ret < 0)
201+
202+
/* ignore errors or packets without data */
203+
if (ret < offsetof(struct u2f_hid_msg, init.data))
202204
return 0;
203205

204206
/* only take the minimum amount of data it is safe to take */

drivers/hid/wacom_wac.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4746,6 +4746,12 @@ static const struct wacom_features wacom_features_0x393 =
47464746
{ "Wacom Intuos Pro S", 31920, 19950, 8191, 63,
47474747
INTUOSP2S_BT, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7,
47484748
.touch_max = 10 };
4749+
static const struct wacom_features wacom_features_0x3c6 =
4750+
{ "Wacom Intuos BT S", 15200, 9500, 4095, 63,
4751+
INTUOSHT3_BT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4 };
4752+
static const struct wacom_features wacom_features_0x3c8 =
4753+
{ "Wacom Intuos BT M", 21600, 13500, 4095, 63,
4754+
INTUOSHT3_BT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4 };
47494755

47504756
static const struct wacom_features wacom_features_HID_ANY_ID =
47514757
{ "Wacom HID", .type = HID_GENERIC, .oVid = HID_ANY_ID, .oPid = HID_ANY_ID };
@@ -4919,6 +4925,8 @@ const struct hid_device_id wacom_ids[] = {
49194925
{ USB_DEVICE_WACOM(0x37A) },
49204926
{ USB_DEVICE_WACOM(0x37B) },
49214927
{ BT_DEVICE_WACOM(0x393) },
4928+
{ BT_DEVICE_WACOM(0x3c6) },
4929+
{ BT_DEVICE_WACOM(0x3c8) },
49224930
{ USB_DEVICE_WACOM(0x4001) },
49234931
{ USB_DEVICE_WACOM(0x4004) },
49244932
{ USB_DEVICE_WACOM(0x5000) },

0 commit comments

Comments
 (0)