aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-core.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2018-08-20 18:09:06 +0200
committerJiri Kosina <jkosina@suse.cz>2018-08-20 18:09:06 +0200
commit16501e846dd23f56a23330cd874cfbfaf60daf1a (patch)
tree22513a8f89b046b8feeb84a43ad754ea66441a5d /drivers/hid/hid-core.c
parentMerge branch 'for-4.19/intel-ish' into for-linus (diff)
parentHID: multitouch: handle palm for touchscreens (diff)
downloadlinux-dev-16501e846dd23f56a23330cd874cfbfaf60daf1a.tar.xz
linux-dev-16501e846dd23f56a23330cd874cfbfaf60daf1a.zip
Merge branch 'for-4.19/multitouch-multiaxis' into for-linus
Multitouch updates: - Dial support - Palm rejection for touchscreens - a few small assorted fixes
Diffstat (limited to 'drivers/hid/hid-core.c')
-rw-r--r--drivers/hid/hid-core.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 402ad974b31c..3da354af7a0a 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -128,9 +128,19 @@ static int open_collection(struct hid_parser *parser, unsigned type)
usage = parser->local.usage[0];
- if (parser->collection_stack_ptr == HID_COLLECTION_STACK_SIZE) {
- hid_err(parser->device, "collection stack overflow\n");
- return -EINVAL;
+ if (parser->collection_stack_ptr == parser->collection_stack_size) {
+ unsigned int *collection_stack;
+ unsigned int new_size = parser->collection_stack_size +
+ HID_COLLECTION_STACK_SIZE;
+
+ collection_stack = krealloc(parser->collection_stack,
+ new_size * sizeof(unsigned int),
+ GFP_KERNEL);
+ if (!collection_stack)
+ return -ENOMEM;
+
+ parser->collection_stack = collection_stack;
+ parser->collection_stack_size = new_size;
}
if (parser->device->maxcollection == parser->device->collection_size) {
@@ -840,6 +850,7 @@ static int hid_scan_report(struct hid_device *hid)
break;
}
+ kfree(parser->collection_stack);
vfree(parser);
return 0;
}