HID: core: Do not call request_module() in async context
authorHans de Goede <hdegoede@redhat.com>
Thu, 4 Apr 2019 13:51:32 +0000 (15:51 +0200)
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>
Fri, 5 Apr 2019 15:35:02 +0000 (17:35 +0200)
commit4ceabaf7909d109db6afbffc4ed182741fc32043
treeb64def112a3fbfe3bb135ac35b5fddc9e459464a
parenta025a18fecd4429f4ca66b1746001263c052ecbb
HID: core: Do not call request_module() in async context

request_module() may not be called form async context and in some cases
hid devices may be added from an async context. One example of this
happening is under hyperv, where this was triggering a WARN_ON in
request_module():

[   11.174497]  hid_add_device+0xee/0x2b0 [hid]
[   11.174499]  mousevsc_probe+0x223/0x2eb [hid_hyperv]
[   11.174501]  vmbus_probe+0x3a/0x90
[   11.174504]  really_probe+0x229/0x420
[   11.174506]  driver_probe_device+0x115/0x130
[   11.174507]  __driver_attach_async_helper+0x87/0x90
[   11.174509]  async_run_entry_fn+0x37/0x150

This commit skips the request_module(), falling back to the old behavior
of letting userspace deal with this, in case we are called from an async
context.

Cc: Lili Deng <v-lide@microsoft.com>
Reported-by: Lili Deng <v-lide@microsoft.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
drivers/hid/hid-core.c