* [PATCH] PM / QoS: Fix memory leak on resume_latency.notifiers
@ 2017-02-16 17:21 John Keeping
2017-02-18 1:21 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: John Keeping @ 2017-02-16 17:21 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: linux-pm, linux-kernel, John Keeping
Since commit 2d984ad132a8 ("PM / QoS: Introcuce latency tolerance device
PM QoS type") we reassign "c" to point at qos->latency_tolerance before
freeing c->notifiers, but the notifiers field of latency_tolerance is
never used.
Restore the original behaviour of freeing the notifiers pointer on
qos->resume_latency, which is used, and fix the following kmemleak
warning.
unreferenced object 0xed9dba00 (size 64):
comm "kworker/0:1", pid 36, jiffies 4294670128 (age 15202.983s)
hex dump (first 32 bytes):
00 00 00 00 04 ba 9d ed 04 ba 9d ed 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<c06f6084>] kmemleak_alloc+0x74/0xb8
[<c011c964>] kmem_cache_alloc_trace+0x170/0x25c
[<c035f448>] dev_pm_qos_constraints_allocate+0x3c/0xe4
[<c035f574>] __dev_pm_qos_add_request+0x84/0x1a0
[<c035f6cc>] dev_pm_qos_add_request+0x3c/0x54
[<c03c3fc4>] usb_hub_create_port_device+0x110/0x2b8
[<c03b2a60>] hub_probe+0xadc/0xc80
[<c03bb050>] usb_probe_interface+0x1b4/0x260
[<c035773c>] driver_probe_device+0x198/0x40c
[<c0357b14>] __device_attach_driver+0x8c/0x98
[<c0355bbc>] bus_for_each_drv+0x8c/0x9c
[<c0357494>] __device_attach+0x98/0x138
[<c0357c64>] device_initial_probe+0x14/0x18
[<c03569dc>] bus_probe_device+0x30/0x88
[<c0354c54>] device_add+0x430/0x554
[<c03b92d8>] usb_set_configuration+0x660/0x6fc
Fixes: 2d984ad132a8 ("PM / QoS: Introcuce latency tolerance device PM QoS type")
Signed-off-by: John Keeping <john@metanate.com>
---
drivers/base/power/qos.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
index 58fcc758334e..d888d9869b6a 100644
--- a/drivers/base/power/qos.c
+++ b/drivers/base/power/qos.c
@@ -281,7 +281,7 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
dev->power.qos = ERR_PTR(-ENODEV);
spin_unlock_irq(&dev->power.lock);
- kfree(c->notifiers);
+ kfree(qos->resume_latency.notifiers);
kfree(qos);
out:
--
2.12.0.rc0.230.gf625d4cdb9.dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PM / QoS: Fix memory leak on resume_latency.notifiers
2017-02-16 17:21 [PATCH] PM / QoS: Fix memory leak on resume_latency.notifiers John Keeping
@ 2017-02-18 1:21 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2017-02-18 1:21 UTC (permalink / raw)
To: John Keeping; +Cc: linux-pm, linux-kernel
On Thursday, February 16, 2017 05:21:50 PM John Keeping wrote:
> Since commit 2d984ad132a8 ("PM / QoS: Introcuce latency tolerance device
> PM QoS type") we reassign "c" to point at qos->latency_tolerance before
> freeing c->notifiers, but the notifiers field of latency_tolerance is
> never used.
>
> Restore the original behaviour of freeing the notifiers pointer on
> qos->resume_latency, which is used, and fix the following kmemleak
> warning.
>
> unreferenced object 0xed9dba00 (size 64):
> comm "kworker/0:1", pid 36, jiffies 4294670128 (age 15202.983s)
> hex dump (first 32 bytes):
> 00 00 00 00 04 ba 9d ed 04 ba 9d ed 00 00 00 00 ................
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> backtrace:
> [<c06f6084>] kmemleak_alloc+0x74/0xb8
> [<c011c964>] kmem_cache_alloc_trace+0x170/0x25c
> [<c035f448>] dev_pm_qos_constraints_allocate+0x3c/0xe4
> [<c035f574>] __dev_pm_qos_add_request+0x84/0x1a0
> [<c035f6cc>] dev_pm_qos_add_request+0x3c/0x54
> [<c03c3fc4>] usb_hub_create_port_device+0x110/0x2b8
> [<c03b2a60>] hub_probe+0xadc/0xc80
> [<c03bb050>] usb_probe_interface+0x1b4/0x260
> [<c035773c>] driver_probe_device+0x198/0x40c
> [<c0357b14>] __device_attach_driver+0x8c/0x98
> [<c0355bbc>] bus_for_each_drv+0x8c/0x9c
> [<c0357494>] __device_attach+0x98/0x138
> [<c0357c64>] device_initial_probe+0x14/0x18
> [<c03569dc>] bus_probe_device+0x30/0x88
> [<c0354c54>] device_add+0x430/0x554
> [<c03b92d8>] usb_set_configuration+0x660/0x6fc
>
> Fixes: 2d984ad132a8 ("PM / QoS: Introcuce latency tolerance device PM QoS type")
> Signed-off-by: John Keeping <john@metanate.com>
Applied.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-18 1:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-16 17:21 [PATCH] PM / QoS: Fix memory leak on resume_latency.notifiers John Keeping
2017-02-18 1:21 ` Rafael J. Wysocki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.