summaryrefslogtreecommitdiff
path: root/drivers/hid/hid-core.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2018-08-20 19:09:06 +0300
committerJiri Kosina <jkosina@suse.cz>2018-08-20 19:09:06 +0300
commit16501e846dd23f56a23330cd874cfbfaf60daf1a (patch)
tree22513a8f89b046b8feeb84a43ad754ea66441a5d /drivers/hid/hid-core.c
parentf5dd80715ae1f34909cb04f29b7092dfc6717ed7 (diff)
parent28a042a3b7ab3e28039d6309f0764a8e4c1b261d (diff)
downloadlinux-16501e846dd23f56a23330cd874cfbfaf60daf1a.tar.xz
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;
}