Skip to content
Commit 4ea5763f authored by Jann Horn's avatar Jann Horn Committed by Jiri Kosina
Browse files

HID: uhid: Fix worker destroying device without any protection



uhid has to run hid_add_device() from workqueue context while allowing
parallel use of the userspace API (which is protected with ->devlock).
But hid_add_device() can fail. Currently, that is handled by immediately
destroying the associated HID device, without using ->devlock - but if
there are concurrent requests from userspace, that's wrong and leads to
NULL dereferences and/or memory corruption (via use-after-free).

Fix it by leaving the HID device as-is in the worker. We can clean it up
later, either in the UHID_DESTROY command handler or in the ->release()
handler.

Cc: stable@vger.kernel.org
Fixes: 67f8ecc5 ("HID: uhid: fix timeout when probe races with IO")
Signed-off-by: default avatarJann Horn <jannh@google.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent e24aeff6
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment