Fixes kernel oops when turning bluetooth mouse on
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Lamarque V. Souza
This patch against kernel 3.7.0-rc8 fixes a kernel oops when turning on the bluetooth mouse with id 0458:0058 [1].
The mouse in question supports both input and hid sessions, however it is blacklisted in
drivers/hid/hid-core.cso the input session is one that should be used. Long ago (around kernel 3.0.0) some changes in the bluetooth subsystem made the kernel do not fallback to input session when hid session is not supported or blacklisted. This patch restore that behaviour by making the kernel try the input session ifhid_add_devicereturns ENODEV.
Quoted 6 lines
OBS: The patch exports
hid_ignore()fromhid-core.cso that it can be used in the bluetooth subsystem.[1] https://bugzilla.kernel.org/show_bug.cgi?id=39882
Signed-off-by Lamarque V. Souza <[email protected]>
I am fine with the hid core change. Adding Gustavo and linux-bluetooth@ for the net/bluetooth/hidp/ change ... Gustavo, could you please give me Ack on the Bluetooth part so that I could merge it?
Thanks.
Quoted 76 lines
---
diff -Nrup
a/drivers/hid/hid-core.cb/drivers/hid/hid-core.cdrivers/hid/hid-core.c +8
-3@@ -2150,8 +2150,13 @@ static const struct hid_device_id hid_mo { } }; -static bool hid_ignore (struct hid_device *hdev) +bool hid_ignore (struct hid_device *hdev) { +if (hdev->quirks &HID_QUIRK_NO_IGNORE ) +return false; +if (hdev->quirks &HID_QUIRK_IGNORE ) +return true; +switch (hdev->vendor) {case USB_VENDOR_ID_CODEMERCS :/* ignore all Code Mercenaries IOWarrior devices */ @@ -2197,6 +2202,7 @@ static bool hid_ignore(struct hid_devicereturn !!hid_match_id (hdev, hid_ignore_list); } +EXPORT_SYMBOL_GPL (hid_ignore);int hid_add_device (struct hid_device *hdev) {@@ -2208,8 +2214,7 @@ int hid_add_device(struct hid_device *hd/* we need to kill them here, otherwise they will stay allocated to * wait for coming driver */ -if (!(hdev->quirks &HID_QUIRK_NO_IGNORE ) - && (hid_ignore (hdev) || (hdev->quirks &HID_QUIRK_IGNORE ))) +if (hid_ignore (hdev))return -ENODEV ;/* diff -Nrup
a/include/linux/hid.hb/include/linux/hid.hinclude/linux/hid.h +1
-0@@ -684,6 +684,7 @@ struct hid_ll_driver {extern int hid_debug; +extern bool hid_ignore (struct hid_device *);extern int hid_add_device (struct hid_device *);extern void hid_destroy_device (struct hid_device *);diff -Nrup
a/net/bluetooth/hidp/core.cb/net/bluetooth/hidp/core.cnet/bluetooth/hidp/core.c +8
-1@@ -941,6 +941,13 @@ static int hidp_setup_hid(struct hidp_se hid->hid_get_raw_report = hidp_get_raw_report; hid->hid_output_raw_report = hidp_output_raw_report; +/* True if device is blacklisted in drivers/hid/hid-core.c */ +if (hid_ignore (hid)) { +hid_destroy_device (session->hid); + session->hid =NULL ; +return -ENODEV ; + } +return 0 ; fault:@@ -1013,7 +1020,7 @@ int hidp_add_connection(struct hidp_connif (req->rd_size >0 ) { err =hidp_setup_hid (session, req); -if (err) +if (err && err != -ENODEV ) goto purge; }
Signature · 2 lines
Jiri Kosina SUSE Labs
Gustavo Padovan
Acked-byHi Jiri,
Quoted 93 lines · Jiri Kosina
Quoted 10 lines · Lamarque V. Souza
This patch against kernel 3.7.0-rc8 fixes a kernel oops when turning on the bluetooth mouse with id 0458:0058 [1].
The mouse in question supports both input and hid sessions, however it is blacklisted in
drivers/hid/hid-core.cso the input session is one that should be used. Long ago (around kernel 3.0.0) some changes in the bluetooth subsystem made the kernel do not fallback to input session when hid session is not supported or blacklisted. This patch restore that behaviour by making the kernel try the input session ifhid_add_devicereturns ENODEV.Quoted 6 lines
OBS: The patch exports
hid_ignore()fromhid-core.cso that it can be used in the bluetooth subsystem.[1] https://bugzilla.kernel.org/show_bug.cgi?id=39882
Signed-off-by Lamarque V. Souza <[email protected]>I am fine with the hid core change. Adding Gustavo and linux-bluetooth@ for the
net/bluetooth/hidp/change ... Gustavo, could you please give me Ack on the Bluetooth part so that I could merge it?Thanks.
Quoted 68 lines
---
diff -Nrup
a/drivers/hid/hid-core.cb/drivers/hid/hid-core.cdrivers/hid/hid-core.c +8
-3@@ -2150,8 +2150,13 @@ static const struct hid_device_id hid_mo { } }; -static bool hid_ignore (struct hid_device *hdev) +bool hid_ignore (struct hid_device *hdev) { +if (hdev->quirks &HID_QUIRK_NO_IGNORE ) +return false; +if (hdev->quirks &HID_QUIRK_IGNORE ) +return true; +switch (hdev->vendor) {case USB_VENDOR_ID_CODEMERCS :/* ignore all Code Mercenaries IOWarrior devices */ @@ -2197,6 +2202,7 @@ static bool hid_ignore(struct hid_devicereturn !!hid_match_id (hdev, hid_ignore_list); } +EXPORT_SYMBOL_GPL (hid_ignore);int hid_add_device (struct hid_device *hdev) {@@ -2208,8 +2214,7 @@ int hid_add_device(struct hid_device *hd/* we need to kill them here, otherwise they will stay allocated to * wait for coming driver */ -if (!(hdev->quirks &HID_QUIRK_NO_IGNORE ) - && (hid_ignore (hdev) || (hdev->quirks &HID_QUIRK_IGNORE ))) +if (hid_ignore (hdev))return -ENODEV ;/* diff -Nrup
a/include/linux/hid.hb/include/linux/hid.hinclude/linux/hid.h +1
-0@@ -684,6 +684,7 @@ struct hid_ll_driver {extern int hid_debug; +extern bool hid_ignore (struct hid_device *);extern int hid_add_device (struct hid_device *);extern void hid_destroy_device (struct hid_device *);diff -Nrup
a/net/bluetooth/hidp/core.cb/net/bluetooth/hidp/core.cnet/bluetooth/hidp/core.c +7
-0@@ -941,6 +941,13 @@ static int hidp_setup_hid(struct hidp_se hid->hid_get_raw_report = hidp_get_raw_report; hid->hid_output_raw_report = hidp_output_raw_report; +/* True if device is blacklisted in drivers/hid/hid-core.c */ +if (hid_ignore (hid)) { +hid_destroy_device (session->hid); + session->hid =NULL ; +return -ENODEV ; + } +return 0 ; fault:@@ -1013,7 +1020,7 @@ int hidp_add_connection(struct hidp_conn
Quoted 6 lines
net/bluetooth/hidp/core.c int hidp_add_connection(struct hidp_conn · line 1025
Quoted 6 lines
net/bluetooth/hidp/core.c +1
-1if (req->rd_size >0 ) { err =hidp_setup_hid (session, req); -if (err) +if (err && err != -ENODEV ) goto purge; }
Gustavo
Quoted 66 lines · Gustavo Padovan
Quoted 66 lines
Quoted 66 lines
diff -Nrup
a/drivers/hid/hid-core.cb/drivers/hid/hid-core.cdrivers/hid/hid-core.c +8
-3@@ -2150,8 +2150,13 @@ static const struct hid_device_id hid_mo { } }; -static bool hid_ignore (struct hid_device *hdev) +bool hid_ignore (struct hid_device *hdev) { +if (hdev->quirks &HID_QUIRK_NO_IGNORE ) +return false; +if (hdev->quirks &HID_QUIRK_IGNORE ) +return true; +switch (hdev->vendor) {case USB_VENDOR_ID_CODEMERCS :/* ignore all Code Mercenaries IOWarrior devices */ @@ -2197,6 +2202,7 @@ static bool hid_ignore(struct hid_devicereturn !!hid_match_id (hdev, hid_ignore_list); } +EXPORT_SYMBOL_GPL (hid_ignore);int hid_add_device (struct hid_device *hdev) {@@ -2208,8 +2214,7 @@ int hid_add_device(struct hid_device *hd/* we need to kill them here, otherwise they will stay allocated to * wait for coming driver */ -if (!(hdev->quirks &HID_QUIRK_NO_IGNORE ) - && (hid_ignore (hdev) || (hdev->quirks &HID_QUIRK_IGNORE ))) +if (hid_ignore (hdev))return -ENODEV ;/* diff -Nrup
a/include/linux/hid.hb/include/linux/hid.hinclude/linux/hid.h +1
-0@@ -684,6 +684,7 @@ struct hid_ll_driver {extern int hid_debug; +extern bool hid_ignore (struct hid_device *);extern int hid_add_device (struct hid_device *);extern void hid_destroy_device (struct hid_device *);diff -Nrup
a/net/bluetooth/hidp/core.cb/net/bluetooth/hidp/core.cnet/bluetooth/hidp/core.c +7
-0@@ -941,6 +941,13 @@ static int hidp_setup_hid(struct hidp_se hid->hid_get_raw_report = hidp_get_raw_report; hid->hid_output_raw_report = hidp_output_raw_report; +/* True if device is blacklisted in drivers/hid/hid-core.c */ +if (hid_ignore (hid)) { +hid_destroy_device (session->hid); + session->hid =NULL ; +return -ENODEV ; + } +return 0 ; fault:@@ -1013,7 +1020,7 @@ int hidp_add_connection(struct hidp_conn
Quoted 8 lines
Quoted 6 lines
net/bluetooth/hidp/core.c int hidp_add_connection(struct hidp_conn · line 1025
Quoted 6 lines
net/bluetooth/hidp/core.c +1
-1if (req->rd_size >0 ) { err =hidp_setup_hid (session, req); -if (err) +if (err && err != -ENODEV ) goto purge; }Acked-by Gustavo Padovan <[email protected]>
Queuing in hid.git, thanks.
Signature · 2 lines
Jiri Kosina SUSE Labs