HID: hiddev: fix memory corruption due to invalid intfdata
authorJiri Kosina <jkosina@suse.cz>
Fri, 13 Aug 2010 10:19:45 +0000 (12:19 +0200)
committerJiri Kosina <jkosina@suse.cz>
Fri, 13 Aug 2010 10:19:45 +0000 (12:19 +0200)
commit9c9e54a8df0be48aa359744f412377cc55c3b7d2
tree1df6c9dde015a961c2841437cb757e36119e7ea6
parent7032269e87ade34cc12891675371fa2ac150a620
HID: hiddev: fix memory corruption due to invalid intfdata

Commit bd25f4dd6972755579d0 ("HID: hiddev: use usb_find_interface,
get rid of BKL") introduced using of private intfdata in hiddev for
purpose of storing hiddev pointer.

This is a problem, because intf pointer is already being set to struct
hid_device pointer by HID core. This obviously lead to memory corruptions
at device disconnect time, such as

WARNING: at lib/kobject.c:595 kobject_put+0x37/0x4b()
kobject: '(null)' (ffff88011e9cd898): is not initialized, yet kobject_put() is being called.

Convert hiddev into accessing hiddev through struct hid_device which is
in intfdata already.

Reported-and-tested-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Reported-and-tested-by: Heinz Diehl <htd@fritha.org>
Reported-and-tested-by: Alan Ott <alan@signal11.us>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/usbhid/hiddev.c