From: "Rafael J. Wysocki" Subject: Re: [PATCH] PM / QoS: Fix memory leak on resume_latency.notifiers Date: Sat, 18 Feb 2017 02:21:56 +0100 Message-ID: <2976806.GAICYqDY4c@aspire.rjw.lan> References: <20170216172150.17948-1-john@metanate.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Return-path: Received: from cloudserver094114.home.net.pl ([79.96.170.134]:59168 "EHLO cloudserver094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752446AbdBRB04 (ORCPT ); Fri, 17 Feb 2017 20:26:56 -0500 In-Reply-To: <20170216172150.17948-1-john@metanate.com> Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: John Keeping Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org 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: > [] 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 Applied. Thanks, Rafael