Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752609AbdI1DQ6 (ORCPT ); Wed, 27 Sep 2017 23:16:58 -0400 Received: from regular1.263xmail.com ([211.150.99.132]:45713 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752343AbdI1DQ4 (ORCPT ); Wed, 27 Sep 2017 23:16:56 -0400 X-263anti-spam: KSV:0;BIG:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ADDR-CHECKED4: 1 X-ABS-CHECKED: 1 X-SKE-CHECKED: 1 X-ANTISPAM-LEVEL: 2 X-RL-SENDER: jeffy.chen@rock-chips.com X-FST-TO: seanpaul@chromium.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: jeffy.chen@rock-chips.com X-UNIQUE-TAG: <7c5ec2ed4e10678d4360ece46eef0f18> X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 Message-ID: <59CC6996.2000402@rock-chips.com> Date: Thu, 28 Sep 2017 11:16:38 +0800 From: jeffy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20130126 Thunderbird/19.0 MIME-Version: 1.0 To: Sean Paul CC: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] drm/rockchip: Fix memory leak in rockchip_drm_sys_resume() References: <20170927122642.18628-1-jeffy.chen@rock-chips.com> <20170927202709.ugbjyi3ktfjssiyp@art_vandelay> In-Reply-To: <20170927202709.ugbjyi3ktfjssiyp@art_vandelay> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1218 Lines: 37 Hi Sean, On 09/28/2017 04:27 AM, Sean Paul wrote: >> >@@ -299,6 +300,7 @@ static int rockchip_drm_sys_resume(struct device *dev) >> > >> > priv = drm->dev_private; >> > drm_atomic_helper_resume(drm, priv->state); >> >+ drm_atomic_state_put(priv->state); > Won't this be freed for you eventually in commit_tail()? > i think the drm_atomic_state_put in commit_tail is paired to the drm_atomic_state_get in drm_atomic_helper_commit. and the kmemleak shows(after a few suspend/resume): unreferenced object 0xffffffc0ce0fa400 (size 256): ... backtrace: [] __save_stack_trace+0x48/0x6c [] create_object+0x138/0x254 [] kmemleak_alloc+0x58/0x8c [] __kmalloc+0x1d4/0x2a0 [] usb_alloc_urb+0x30/0x60 [] alloc_ctrl_urb+0x38/0x120 [btusb] [] btusb_send_frame+0x64/0xf8 [btusb] checking the current code, i saw only i915/intel_display.c has this drm_atomic_state_put for the state allocated by drm_atomic_helper_suspend(), there're many drivers missing that(or maybe they free it in some other way?) > Sean >