]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
HID: hid-steam: Fix use-after-free when detaching device
authorVicki Pfau <vi@endrift.com>
Thu, 27 Feb 2025 23:41:33 +0000 (15:41 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 12:02:06 +0000 (13:02 +0100)
commita899adf7063c6745aaff1ec869f3c7f6329ed0a1
treeddc4772583a3bd422755c07defcdf3ee6dc3cda2
parent89f92c4215a681226ebd72ed0ab3dea9b40d3a7c
HID: hid-steam: Fix use-after-free when detaching device

[ Upstream commit e53fc232a65f7488ab75d03a5b95f06aaada7262 ]

When a hid-steam device is removed it must clean up the client_hdev used for
intercepting hidraw access. This can lead to scheduling deferred work to
reattach the input device. Though the cleanup cancels the deferred work, this
was done before the client_hdev itself is cleaned up, so it gets rescheduled.
This patch fixes the ordering to make sure the deferred work is properly
canceled.

Reported-by: syzbot+0154da2d403396b2bd59@syzkaller.appspotmail.com
Fixes: 79504249d7e2 ("HID: hid-steam: Move hidraw input (un)registering to work")
Signed-off-by: Vicki Pfau <vi@endrift.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/hid-steam.c