linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: core: cleanup .claimed field on disconnect
@ 2014-11-03 20:33 Benjamin Tissoires
  2014-11-03 22:45 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Tissoires @ 2014-11-03 20:33 UTC (permalink / raw)
  To: Jiri Kosina, Nestor Lopez Casado, Andrew de los Reyes
  Cc: linux-input, linux-kernel

When a subdriver is rmmod-ed then re-insmod-ed, the hid device is not
destroyed as it is owned by the transport layer.
So when we re-probed the device, the hid device is assumed to be already
claimed, and can lead to page faults if hid-core tries to forward the
emitted data to the to-be-created claimed node.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---

Hi Jiri,

[keeping the people involved in the logitech-hidpp driver in CC]

this one was particularly nasty. I had several page faults when just
rmmod && insmod the hid-logitech-hidpp driver. The page fault was occuring
in hidraw :/
I was not able to get a stacktrace which I could include here. The laptop was
completely unresponsive and I could take only a picture to debug it.

Cheers,
Benjamin

 drivers/hid/hid-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 1e2d512..bbb138d 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1656,6 +1656,7 @@ void hid_disconnect(struct hid_device *hdev)
 		hdev->hiddev_disconnect(hdev);
 	if (hdev->claimed & HID_CLAIMED_HIDRAW)
 		hidraw_disconnect(hdev);
+	hdev->claimed = 0;
 }
 EXPORT_SYMBOL_GPL(hid_disconnect);
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] HID: core: cleanup .claimed field on disconnect
  2014-11-03 20:33 [PATCH] HID: core: cleanup .claimed field on disconnect Benjamin Tissoires
@ 2014-11-03 22:45 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2014-11-03 22:45 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Nestor Lopez Casado, Andrew de los Reyes, linux-input,
	linux-kernel

On Mon, 3 Nov 2014, Benjamin Tissoires wrote:

> When a subdriver is rmmod-ed then re-insmod-ed, the hid device is not
> destroyed as it is owned by the transport layer.
> So when we re-probed the device, the hid device is assumed to be already
> claimed, and can lead to page faults if hid-core tries to forward the
> emitted data to the to-be-created claimed node.
> 
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
> 
> Hi Jiri,
> 
> [keeping the people involved in the logitech-hidpp driver in CC]
> 
> this one was particularly nasty. I had several page faults when just
> rmmod && insmod the hid-logitech-hidpp driver. The page fault was occuring
> in hidraw :/
> I was not able to get a stacktrace which I could include here. The laptop was
> completely unresponsive and I could take only a picture to debug it.

Thanks a lot for tracking it down, Benjamin, tricky one indeed. Queuing 
for 3.18 still.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-03 22:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-03 20:33 [PATCH] HID: core: cleanup .claimed field on disconnect Benjamin Tissoires
2014-11-03 22:45 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).