提交 ef14a4bf 编写于 作者: A Andrew Duggan 提交者: Jiri Kosina

HID: rmi: Check that a device is a RMI device before calling RMI functions

The hid-rmi driver may handle non rmi devices on composite USB devices.
Callbacks need to make sure that the current device is a RMI device before
calling RMI specific functions. Most callbacks already have this check, but
this patch adds checks to the remaining callbacks.
Reported-by: NHendrik Langer <hendrik.langer@gmx.de>
Tested-by: NHendrik Langer <hendrik.langer@gmx.de>
Reviewed-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: NAndrew Duggan <aduggan@synaptics.com>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 1fc26792
......@@ -368,6 +368,11 @@ static int rmi_check_sanity(struct hid_device *hdev, u8 *data, int size)
static int rmi_raw_event(struct hid_device *hdev,
struct hid_report *report, u8 *data, int size)
{
struct rmi_data *hdata = hid_get_drvdata(hdev);
if (!(hdata->device_flags & RMI_DEVICE))
return 0;
size = rmi_check_sanity(hdev, data, size);
if (size < 2)
return 0;
......@@ -713,9 +718,11 @@ static void rmi_remove(struct hid_device *hdev)
{
struct rmi_data *hdata = hid_get_drvdata(hdev);
clear_bit(RMI_STARTED, &hdata->flags);
cancel_work_sync(&hdata->reset_work);
rmi_unregister_transport_device(&hdata->xport);
if (hdata->device_flags & RMI_DEVICE) {
clear_bit(RMI_STARTED, &hdata->flags);
cancel_work_sync(&hdata->reset_work);
rmi_unregister_transport_device(&hdata->xport);
}
hid_hw_stop(hdev);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册