Messages in this thread Patch in this message | | | From | Bartosz Golaszewski <> | Subject | [PATCH 2/2] genirq: proc: fix a procfs entry leak | Date | Mon, 14 Aug 2023 11:36:21 +0200 |
| |
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
When removing the proc entry for a desc that still has active users, we will leak the irqaction entries. Let's remove them in unregister_irq_proc().
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> --- kernel/irq/proc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index 83ed403991c6..b284604a091a 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c @@ -390,6 +390,15 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc) mutex_unlock(®ister_lock); } +static void unregister_action_proc(struct irqaction *action) +{ + if (!action) + return; + + unregister_action_proc(action->secondary); + unregister_handler_proc(action); +} + void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) { char name [MAX_NAMELEN]; @@ -408,6 +417,12 @@ void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) #endif remove_proc_entry("spurious", desc->dir); + /* + * If at this point, this irq desc is still requested, we need to + * remove the proc handler entries or we'll leak them. + */ + unregister_action_proc(desc->action); + sprintf(name, "%u", irq); remove_proc_entry(name, root_irq_dir); } -- 2.39.2
| |