mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
HID: core: replace the collection tree pointers with indices
Previously, the pointer to the parent collection was stored. If a device
exceeds 16 collections (HID_DEFAULT_NUM_COLLECTIONS), the array to store
the collections is reallocated, the pointer to the parent collection becomes
invalid.
Replace the pointers with an index-based lookup into the collections array.
Fixes: c53431eb69 ("HID: core: store the collections as a basic tree")
Reported-by: Pandruvada, Srinivas <srinivas.pandruvada@intel.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Kyle Pelton <kyle.d.pelton@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
committed by
Jiri Kosina
parent
cf26057a94
commit
ee46967fc6
@@ -430,7 +430,7 @@ struct hid_local {
|
||||
*/
|
||||
|
||||
struct hid_collection {
|
||||
struct hid_collection *parent;
|
||||
int parent_idx; /* device->collection */
|
||||
unsigned type;
|
||||
unsigned usage;
|
||||
unsigned level;
|
||||
@@ -658,7 +658,7 @@ struct hid_parser {
|
||||
unsigned int *collection_stack;
|
||||
unsigned int collection_stack_ptr;
|
||||
unsigned int collection_stack_size;
|
||||
struct hid_collection *active_collection;
|
||||
int active_collection_idx; /* device->collection */
|
||||
struct hid_device *device;
|
||||
unsigned int scan_flags;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user