HID: fix incorrect free in hiddev
If hiddev_open() fails, it wrongly frees the shared hiddev structure
kept in hiddev_table instead of the hiddev_list structure allocated
for the opened file descriptor. Existing references to this structure
will then accessed free memory.
This was introduced by 079034073
"HID: hiddev cleanup -- handle all
error conditions properly".
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Oliver Neukum <oliver@neukum.name>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
committed by
Jiri Kosina
parent
d2f8d7ee1a
commit
48e7a3c95c
@@ -306,7 +306,7 @@ static int hiddev_open(struct inode *inode, struct file *file)
|
|||||||
return 0;
|
return 0;
|
||||||
bail:
|
bail:
|
||||||
file->private_data = NULL;
|
file->private_data = NULL;
|
||||||
kfree(list->hiddev);
|
kfree(list);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user