* [PATCH] irqdomain: Fix a memory leak in irq_domain_push_irq()
@ 2020-01-20 4:35 Kevin Hao
2020-01-20 8:08 ` Marc Zyngier
2020-01-24 19:11 ` [tip: irq/core] " tip-bot2 for Kevin Hao
0 siblings, 2 replies; 3+ messages in thread
From: Kevin Hao @ 2020-01-20 4:35 UTC (permalink / raw)
To: linux-kernel; +Cc: Marc Zyngier, Thomas Gleixner, David Daney
Fix a memory leak reported by kmemleak:
unreferenced object 0xffff000bc6f50e80 (size 128):
comm "kworker/23:2", pid 201, jiffies 4294894947 (age 942.132s)
hex dump (first 32 bytes):
00 00 00 00 41 00 00 00 86 c0 03 00 00 00 00 00 ....A...........
00 a0 b2 c6 0b 00 ff ff 40 51 fd 10 00 80 ff ff ........@Q......
backtrace:
[<00000000e62d2240>] kmem_cache_alloc_trace+0x1a4/0x320
[<00000000279143c9>] irq_domain_push_irq+0x7c/0x188
[<00000000d9f4c154>] thunderx_gpio_probe+0x3ac/0x438
[<00000000fd09ec22>] pci_device_probe+0xe4/0x198
[<00000000d43eca75>] really_probe+0xdc/0x320
[<00000000d3ebab09>] driver_probe_device+0x5c/0xf0
[<000000005b3ecaa0>] __device_attach_driver+0x88/0xc0
[<000000004e5915f5>] bus_for_each_drv+0x7c/0xc8
[<0000000079d4db41>] __device_attach+0xe4/0x140
[<00000000883bbda9>] device_initial_probe+0x18/0x20
[<000000003be59ef6>] bus_probe_device+0x98/0xa0
[<0000000039b03d3f>] deferred_probe_work_func+0x74/0xa8
[<00000000870934ce>] process_one_work+0x1c8/0x470
[<00000000e3cce570>] worker_thread+0x1f8/0x428
[<000000005d64975e>] kthread+0xfc/0x128
[<00000000f0eaa764>] ret_from_fork+0x10/0x18
Fixes: 495c38d3001f ("irqdomain: Add irq_domain_{push,pop}_irq() functions")
Cc: stable@vger.kernel.org
Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
kernel/irq/irqdomain.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index dd822fd8a7d5..480df3659720 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -1459,6 +1459,7 @@ int irq_domain_push_irq(struct irq_domain *domain, int virq, void *arg)
if (rv) {
/* Restore the original irq_data. */
*root_irq_data = *child_irq_data;
+ kfree(child_irq_data);
goto error;
}
--
2.14.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] irqdomain: Fix a memory leak in irq_domain_push_irq()
2020-01-20 4:35 [PATCH] irqdomain: Fix a memory leak in irq_domain_push_irq() Kevin Hao
@ 2020-01-20 8:08 ` Marc Zyngier
2020-01-24 19:11 ` [tip: irq/core] " tip-bot2 for Kevin Hao
1 sibling, 0 replies; 3+ messages in thread
From: Marc Zyngier @ 2020-01-20 8:08 UTC (permalink / raw)
To: Kevin Hao; +Cc: linux-kernel, Thomas Gleixner, David Daney
On Mon, 20 Jan 2020 12:35:47 +0800
Kevin Hao <haokexin@gmail.com> wrote:
> Fix a memory leak reported by kmemleak:
> unreferenced object 0xffff000bc6f50e80 (size 128):
> comm "kworker/23:2", pid 201, jiffies 4294894947 (age 942.132s)
> hex dump (first 32 bytes):
> 00 00 00 00 41 00 00 00 86 c0 03 00 00 00 00 00 ....A...........
> 00 a0 b2 c6 0b 00 ff ff 40 51 fd 10 00 80 ff ff ........@Q......
> backtrace:
> [<00000000e62d2240>] kmem_cache_alloc_trace+0x1a4/0x320
> [<00000000279143c9>] irq_domain_push_irq+0x7c/0x188
> [<00000000d9f4c154>] thunderx_gpio_probe+0x3ac/0x438
> [<00000000fd09ec22>] pci_device_probe+0xe4/0x198
> [<00000000d43eca75>] really_probe+0xdc/0x320
> [<00000000d3ebab09>] driver_probe_device+0x5c/0xf0
> [<000000005b3ecaa0>] __device_attach_driver+0x88/0xc0
> [<000000004e5915f5>] bus_for_each_drv+0x7c/0xc8
> [<0000000079d4db41>] __device_attach+0xe4/0x140
> [<00000000883bbda9>] device_initial_probe+0x18/0x20
> [<000000003be59ef6>] bus_probe_device+0x98/0xa0
> [<0000000039b03d3f>] deferred_probe_work_func+0x74/0xa8
> [<00000000870934ce>] process_one_work+0x1c8/0x470
> [<00000000e3cce570>] worker_thread+0x1f8/0x428
> [<000000005d64975e>] kthread+0xfc/0x128
> [<00000000f0eaa764>] ret_from_fork+0x10/0x18
>
> Fixes: 495c38d3001f ("irqdomain: Add irq_domain_{push,pop}_irq() functions")
> Cc: stable@vger.kernel.org
> Signed-off-by: Kevin Hao <haokexin@gmail.com>
> ---
> kernel/irq/irqdomain.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> index dd822fd8a7d5..480df3659720 100644
> --- a/kernel/irq/irqdomain.c
> +++ b/kernel/irq/irqdomain.c
> @@ -1459,6 +1459,7 @@ int irq_domain_push_irq(struct irq_domain *domain, int virq, void *arg)
> if (rv) {
> /* Restore the original irq_data. */
> *root_irq_data = *child_irq_data;
> + kfree(child_irq_data);
> goto error;
> }
>
Nice catch. I'll queue this for 5.6.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip: irq/core] irqdomain: Fix a memory leak in irq_domain_push_irq()
2020-01-20 4:35 [PATCH] irqdomain: Fix a memory leak in irq_domain_push_irq() Kevin Hao
2020-01-20 8:08 ` Marc Zyngier
@ 2020-01-24 19:11 ` tip-bot2 for Kevin Hao
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Kevin Hao @ 2020-01-24 19:11 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Kevin Hao, Marc Zyngier, stable, x86, LKML
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 0f394daef89b38d58c91118a2b08b8a1b316703b
Gitweb: https://git.kernel.org/tip/0f394daef89b38d58c91118a2b08b8a1b316703b
Author: Kevin Hao <haokexin@gmail.com>
AuthorDate: Mon, 20 Jan 2020 12:35:47 +08:00
Committer: Marc Zyngier <maz@kernel.org>
CommitterDate: Mon, 20 Jan 2020 19:10:05
irqdomain: Fix a memory leak in irq_domain_push_irq()
Fix a memory leak reported by kmemleak:
unreferenced object 0xffff000bc6f50e80 (size 128):
comm "kworker/23:2", pid 201, jiffies 4294894947 (age 942.132s)
hex dump (first 32 bytes):
00 00 00 00 41 00 00 00 86 c0 03 00 00 00 00 00 ....A...........
00 a0 b2 c6 0b 00 ff ff 40 51 fd 10 00 80 ff ff ........@Q......
backtrace:
[<00000000e62d2240>] kmem_cache_alloc_trace+0x1a4/0x320
[<00000000279143c9>] irq_domain_push_irq+0x7c/0x188
[<00000000d9f4c154>] thunderx_gpio_probe+0x3ac/0x438
[<00000000fd09ec22>] pci_device_probe+0xe4/0x198
[<00000000d43eca75>] really_probe+0xdc/0x320
[<00000000d3ebab09>] driver_probe_device+0x5c/0xf0
[<000000005b3ecaa0>] __device_attach_driver+0x88/0xc0
[<000000004e5915f5>] bus_for_each_drv+0x7c/0xc8
[<0000000079d4db41>] __device_attach+0xe4/0x140
[<00000000883bbda9>] device_initial_probe+0x18/0x20
[<000000003be59ef6>] bus_probe_device+0x98/0xa0
[<0000000039b03d3f>] deferred_probe_work_func+0x74/0xa8
[<00000000870934ce>] process_one_work+0x1c8/0x470
[<00000000e3cce570>] worker_thread+0x1f8/0x428
[<000000005d64975e>] kthread+0xfc/0x128
[<00000000f0eaa764>] ret_from_fork+0x10/0x18
Fixes: 495c38d3001f ("irqdomain: Add irq_domain_{push,pop}_irq() functions")
Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20200120043547.22271-1-haokexin@gmail.com
---
kernel/irq/irqdomain.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 7a8808c..7527e5e 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -1476,6 +1476,7 @@ int irq_domain_push_irq(struct irq_domain *domain, int virq, void *arg)
if (rv) {
/* Restore the original irq_data. */
*root_irq_data = *child_irq_data;
+ kfree(child_irq_data);
goto error;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-24 19:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20 4:35 [PATCH] irqdomain: Fix a memory leak in irq_domain_push_irq() Kevin Hao
2020-01-20 8:08 ` Marc Zyngier
2020-01-24 19:11 ` [tip: irq/core] " tip-bot2 for Kevin Hao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).