Re: [PATCH] HID: hidraw: fix data race on device refcount

From: Benjamin Tissoires
Date: Wed Jun 21 2023 - 11:56:14 EST


On Wed, 21 Jun 2023 13:17:43 +0200, Ludvig Michaelsson wrote:
> The hidraw_open() function increments the hidraw device reference
> counter. The counter has no dedicated synchronization mechanism,
> resulting in a potential data race when concurrently opening a device.
>
> The race is a regression introduced by commit 8590222e4b02 ("HID:
> hidraw: Replace hidraw device table mutex with a rwsem"). While
> minors_rwsem is intended to protect the hidraw_table itself, by instead
> acquiring the lock for writing, the reference counter is also protected.
> This is symmetrical to hidraw_release().
>
> [...]

Added stable@ cc tags and

Applied to hid/hid.git (for-6.4/upstream-fixes), thanks!

[1/1] HID: hidraw: fix data race on device refcount
https://git.kernel.org/hid/hid/c/944ee77dc6ec

Cheers,
--
Benjamin Tissoires <benjamin.tissoires@xxxxxxxxxx>