Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752445AbdFAPrn (ORCPT ); Thu, 1 Jun 2017 11:47:43 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:33617 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752382AbdFAPpY (ORCPT ); Thu, 1 Jun 2017 11:45:24 -0400 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "John Keeping" , "Rafael J. Wysocki" Date: Thu, 01 Jun 2017 16:43:16 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 138/212] PM / QoS: Fix memory leak on resume_latency.notifiers In-Reply-To: X-SA-Exim-Connect-IP: 82.70.136.246 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2238 Lines: 59 3.16.44-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: John Keeping commit e84b4a84e52d4cd8770b4242cd09df0133333f63 upstream. 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: [] kmemleak_alloc+0x74/0xb8 [] kmem_cache_alloc_trace+0x170/0x25c [] dev_pm_qos_constraints_allocate+0x3c/0xe4 [] __dev_pm_qos_add_request+0x84/0x1a0 [] dev_pm_qos_add_request+0x3c/0x54 [] usb_hub_create_port_device+0x110/0x2b8 [] hub_probe+0xadc/0xc80 [] usb_probe_interface+0x1b4/0x260 [] driver_probe_device+0x198/0x40c [] __device_attach_driver+0x8c/0x98 [] bus_for_each_drv+0x8c/0x9c [] __device_attach+0x98/0x138 [] device_initial_probe+0x14/0x18 [] bus_probe_device+0x30/0x88 [] device_add+0x430/0x554 [] usb_set_configuration+0x660/0x6fc Fixes: 2d984ad132a8 (PM / QoS: Introcuce latency tolerance device PM QoS type) Signed-off-by: John Keeping Signed-off-by: Rafael J. Wysocki Signed-off-by: Ben Hutchings --- drivers/base/power/qos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c @@ -277,7 +277,7 @@ void dev_pm_qos_constraints_destroy(stru dev->power.qos = ERR_PTR(-ENODEV); spin_unlock_irq(&dev->power.lock); - kfree(c->notifiers); + kfree(qos->resume_latency.notifiers); kfree(qos); out: