Skip to content

Commit 3ece74a

Browse files
minipli-ossSasha Levin
authored and
Sasha Levin
committed
Input: synaptics-rmi4 - fix UAF of IRQ domain on driver removal
commit fbf8d71 upstream. Calling irq_domain_remove() will lead to freeing the IRQ domain prematurely. The domain is still referenced and will be attempted to get used via rmi_free_function_list() -> rmi_unregister_function() -> irq_dispose_mapping() -> irq_get_irq_data()'s ->domain pointer. With PaX's MEMORY_SANITIZE this will lead to an access fault when attempting to dereference embedded pointers, as in Torsten's report that was faulting on the 'domain->ops->unmap' test. Fix this by releasing the IRQ domain only after all related IRQs have been deactivated. Fixes: 24d28e4 ("Input: synaptics-rmi4 - convert irq distribution to irq_domain") Reported-by: Torsten Hilbrich <[email protected]> Signed-off-by: Mathias Krause <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]> Signed-off-by: Tzung-Bi Shih <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 6c5df3c commit 3ece74a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/input/rmi4/rmi_driver.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -981,12 +981,12 @@ static int rmi_driver_remove(struct device *dev)
981981

982982
rmi_disable_irq(rmi_dev, false);
983983

984-
irq_domain_remove(data->irqdomain);
985-
data->irqdomain = NULL;
986-
987984
rmi_f34_remove_sysfs(rmi_dev);
988985
rmi_free_function_list(rmi_dev);
989986

987+
irq_domain_remove(data->irqdomain);
988+
data->irqdomain = NULL;
989+
990990
return 0;
991991
}
992992

0 commit comments

Comments
 (0)