gpio: sim: dispose of irq mappings before destroying the irq_sim domain
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 22 Aug 2023 19:29:42 +0000 (21:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Aug 2023 14:11:13 +0000 (16:11 +0200)
commit3c839f8332dfca0e7480b6c03785cc85da2c5415
treeeeb2360bb013e81a31a09834f5593b9b2900b142
parent3282e79a85c1096b1f59925d7a04a4303d605759
gpio: sim: dispose of irq mappings before destroying the irq_sim domain

[ Upstream commit ab4109f91b328ff5cb5e1279f64d443241add2d1 ]

If a GPIO simulator device is unbound with interrupts still requested,
we will hit a use-after-free issue in __irq_domain_deactivate_irq(). The
owner of the irq domain must dispose of all mappings before destroying
the domain object.

Fixes: cb8c474e79be ("gpio: sim: new testing module")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpio/gpio-sim.c