From: Jiri Kosina <jikos@kernel.org>
To: Jann Horn <jannh@google.com>
Cc: David Rheinsberg <david.rheinsberg@gmail.com>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
linux-input@vger.kernel.org,
Roderick Colenbrander <roderick.colenbrander@sony.com>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/2] HID: uhid: Fix worker destroying device without any protection
Date: Wed, 19 Jan 2022 15:59:47 +0100 (CET) [thread overview]
Message-ID: <nycvar.YFH.7.76.2201191559280.28059@cbobk.fhfr.pm> (raw)
In-Reply-To: <20220114133331.873057-1-jannh@google.com>
On Fri, 14 Jan 2022, Jann Horn wrote:
> 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: 67f8ecc550b5 ("HID: uhid: fix timeout when probe races with IO")
> Signed-off-by: Jann Horn <jannh@google.com>
I've queued both patches for 5.17, thanks a lot for fixing this.
--
Jiri Kosina
SUSE Labs
prev parent reply other threads:[~2022-01-19 14:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-14 13:33 Jann Horn
2022-01-14 13:33 ` [PATCH 2/2] HID: uhid: Use READ_ONCE()/WRITE_ONCE() for ->running Jann Horn
2022-01-19 14:59 ` Jiri Kosina [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=nycvar.YFH.7.76.2201191559280.28059@cbobk.fhfr.pm \
--to=jikos@kernel.org \
--cc=benjamin.tissoires@redhat.com \
--cc=david.rheinsberg@gmail.com \
--cc=jannh@google.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roderick.colenbrander@sony.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®