Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751828AbdH1Bac convert rfc822-to-8bit (ORCPT ); Sun, 27 Aug 2017 21:30:32 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:64657 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751802AbdH1Ba3 (ORCPT ); Sun, 27 Aug 2017 21:30:29 -0400 X-AuditID: b6c32a36-f79196d0000051db-fe-59a37233c26a Mime-Version: 1.0 Subject: RE: Re: [PATCH 01/12] PM / devfreq: Fix memory leak when fail to register device Reply-To: myungjoo.ham@samsung.com From: MyungJoo Ham To: Chanwoo Choi , Kyungmin Park CC: "rafael.j.wysocki@intel.com" , "chanwoo@kernel.org" , Inki Dae , "linux-kernel@vger.kernel.org" , "linux-pm@vger.kernel.org" , "stable@vger.kernel.org" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <59A36264.4030605@samsung.com> X-Drm-Type: N,general X-EPLocale: ko_KR.EUC-KR X-EPWebmail-Msg-Type: personal X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Illegal-Object: Syntax error in X-Sender: address found on vger.kernel.org: X-Sender: =?utf-8?B?U2Ftc3VuZyBFbGVjdHJvbmljcxtBcnRpZmljaWFsIEludA==?= ^-Extraneous program text X-Sender-IP: 10.113.73.204 X-Local-Sender: =?UTF-8?B?7ZWo66qF7KO8G0FydGlmaWNpYWwgSW50ZWxsaWdlbmNlIDNMYWIoUy9X?= =?UTF-8?B?7IS87YSwKRvsgrzshLHsoITsnpAbUHJpbmNpcGFsIEVuZ2lu?= =?UTF-8?B?ZWVy?= X-Global-Sender: =?UTF-8?B?TXl1bmdKb28gSGFtG0FydGlmaWNpYWwgSW50ZWxsaWdlbmNlIDNMYWIu?= =?UTF-8?B?G1NhbXN1bmcgRWxlY3Ryb25pY3MbUHJpbmNpcGFsIEVuZ2lu?= =?UTF-8?B?ZWVy?= X-Sender-Code: =?UTF-8?B?QzEwGxtDMTBWODI5MQ==?= Message-ID: <20170828013027epcms1p19d7bf62daf3f571f3e4bf2df3ed85871@epcms1p1> Date: Mon, 28 Aug 2017 01:30:27 +0000 X-CMS-MailID: 20170828013027epcms1p19d7bf62daf3f571f3e4bf2df3ed85871 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="utf-8" X-MTR: 20170828013027epcms1p19d7bf62daf3f571f3e4bf2df3ed85871 CMS-TYPE: 101P X-Brightmail-Tracker: H4sIAAAAAAAAA02Sa0gUURTHuTvj7hhNjavWySBt6KWxq7OuNoYbvRF6aFRQSemkN7X2ITO7 kVFgwaaJ6RaUZVLqhpZFrlZmu1Gg0eODIRWlUVb2IkzT1MIPQjOOUd/+93f/5/zvuRyK0Jdr I6g8uxOLdsHKaqeQLe3RRkO86N0e1+GO5E92vSD5VyNfg/hT7zwk33H0u45/7q/S8sMnHiD+ 4+V+HV/d1IuWUyneu980Kc0Nx7UpZTcbUMpw85w0cgdOzsVCNhajsD3LkZ1nz7Gw6zZnrMpI SIzjDFwSv4SNsgs2bGFXr08zrM2zys9go/YLVpeM0gRJYmOXJYsOlxNH5Tokp4VN5ziTkYtb YjSZTEZz/M6lpgTZkolzx7t/o/xP0w+4j47oCtH16SUomALGDJ8Ka7SqngGdPY2ynkLpmVYE jx8FyBJEUTQTAuOtoYonlEmHY9fdpKL1DAuF3fcIlcdC8fsWpGgtY4BbvrcTnjBmKwSqywil J8H4NXDlbD+phtFwtujzpJ4Nt+tvTRQHM4uhrsKjUXk4dF/t16ka4E1f5ySfA2dGrxF/PT8e XkSqDgN3T8ckD4H3YwGkBAPjRvDm5pfJRhHw2vtSo17UIfA+/6xTD/UIii41aZWRQZ7nzu1V SgHNbIAbFecmEkhmPpwe8CDVshpqb1gUTCiPrukjFEww0dDoj1WjLPDBN0KolmkwMFoapPIF 0Ba4pPOgeZX/vrfyv0aV/xpVI6IBzcD5ki0HS1y+ySgJNsllzzFmOWzNaGIZYxJbUe3T9W2I oRA7lYaF3u36IGG/VGBrQ0ARbBjdZ5URnS0UHMSiI0N0WbHUhhLkcU4SEeFZDnm17c4MzpwU Z040ySuXxHHsTDq88eU2PZMjOPE+jPOx+LdOQwVHFCLb66CLBnd0+W7fSiY7unJje5XhvnaF 1FtCnyo9FEiNPFZe9qi1xzcX7y0NFHftrKquY7nOr/rMTNfA0KB/y7Pi9gujG5xjs55UJKcf 9jy14E0/HZExy3znu0J2pcXQxkXDRCBpTdHQnQX2Hb/MvUcG718rsPhbUme+2iNSP/riWVLK FbgYQpSEP9Y8YcqiAwAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20170824014259epcas2p398a53a9a76d9aff7e35cf8515ec4e46a X-RootMTR: 20170824014259epcas2p398a53a9a76d9aff7e35cf8515ec4e46a References: <59A36264.4030605@samsung.com> <1503538979-22693-2-git-send-email-cw00.choi@samsung.com> <1503538979-22693-1-git-send-email-cw00.choi@samsung.com> <20170828001753epcms1p658026b4f636aa4c0aee6f22bc128ebe3@epcms1p6> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1357 Lines: 74 > On 2017년 08월 28일 09:17, MyungJoo Ham wrote: > >> When the devfreq_add_device fails to register deivce, the memory > >> leak of devfreq instance happen. So, this patch fix the memory > >> leak issue. Before freeing the devfreq instance checks whether > >> devfreq instance is NULL or not because the device_unregister() > >> frees the devfreq instance when jumping to the 'err_init'. > >> It is to prevent the duplicate the kfee(devfreq). > >> > >> Cc: stable@vger.kernel.org > >> Fixes: ac4b281176a5 ("PM / devfreq: fix duplicated kfree on devfreq pointer") > >> Signed-off-by: Chanwoo Choi > >> --- > >> drivers/devfreq/devfreq.c | 5 ++++- > >> 1 file changed, 4 insertions(+), 1 deletion(-) > > > > This looks like to be duplicated. Please check your repo basis. > > These patches is based on the v4.13-rc6. > > After merged ("PM / devfreq: fix duplicated kfree on devfreq pointer"), > this patch doesn't consider the free of memory when error case. > > After applying this patch, this patch consider the error case > when jumping the err_dev statement with goto. > device_unregister(&devfreq->dev); > err_dev: > if (devfreq) > kfree(devfreq); Ah sorry. It looks like I was confused of - and + somehow. Acked-By: MyungJoo Ham. (I'll merge trivial fixes first) > >