]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
um: Add winch to winch_handlers before registering winch IRQ
authorRoberto Sassu <roberto.sassu@huawei.com>
Thu, 7 Mar 2024 10:49:26 +0000 (11:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Jun 2024 11:39:43 +0000 (13:39 +0200)
commit31960d991e43c8d6dc07245f19fc13398e90ead2
tree6e8e3343044d8f311972d4de7a4a06abaece17bd
parent78863940745fac98e9a2a919722b3b193f76b221
um: Add winch to winch_handlers before registering winch IRQ

[ Upstream commit a0fbbd36c156b9f7b2276871d499c9943dfe5101 ]

Registering a winch IRQ is racy, an interrupt may occur before the winch is
added to the winch_handlers list.

If that happens, register_winch_irq() adds to that list a winch that is
scheduled to be (or has already been) freed, causing a panic later in
winch_cleanup().

Avoid the race by adding the winch to the winch_handlers list before
registering the IRQ, and rolling back if um_request_irq() fails.

Fixes: 42a359e31a0e ("uml: SIGIO support cleanup")
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/um/drivers/line.c