]> git.baikalelectronics.ru Git - kernel.git/commit
HID: steam: use hid_device.driver_data instead of hid_set_drvdata()
authorRodrigo Rivas Costa <rodrigorivascosta@gmail.com>
Tue, 22 May 2018 20:10:06 +0000 (22:10 +0200)
committerJiri Kosina <jkosina@suse.cz>
Wed, 20 Jun 2018 07:27:23 +0000 (09:27 +0200)
commit459e5c0c22346ef4a00365e451c7544a2816f0c2
tree8591283d9595a9ab3cd2a7c68e767ec9517d3c51
parent2e87e09d1ff31a1e0a7062c76ee348d7ed470e5a
HID: steam: use hid_device.driver_data instead of hid_set_drvdata()

When creating the low-level hidraw device, the reference to steam_device
was stored using hid_set_drvdata(). But this value is not guaranteed to
be kept when set before calling probe. If this pointer is reset, it
crashes when opening the emulated hidraw device.

It looks like hid_set_drvdata() is for users "avobe" this hid_device,
while hid_device.driver_data it for users "below" this one.

In this case, we are creating a virtual hidraw device, so we must use
hid_device.driver_data.

Signed-off-by: Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
Tested-by: Mariusz Ceier <mceier+kernel@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-steam.c