Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3320789pxu; Sun, 29 Nov 2020 23:33:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJwgGntU4IZSSqs6T/8pBEvyYT5GO7tJR6LrX559C6ZcNQ2LB1sDnCy/yq4mUyLbMhLnSWWN X-Received: by 2002:aa7:da81:: with SMTP id q1mr20186518eds.14.1606721591160; Sun, 29 Nov 2020 23:33:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606721591; cv=none; d=google.com; s=arc-20160816; b=qCrIfYFBkP/+83pg/18rvfzPmdb8Vp7u50iLRMucSSZsVR/1U2Z/gdcCCVpB88FRIa WzD7xDsmWJgzNXILkJHqSuR/I6Dg0p6vkvqopg9Xf1AauDYJTTclek8lxM6v1Qg5Buqm EnK7geFF+dA6oGnFbQezbV8nY2yTRyc+cSqw8CsxKQQD+omsCGmhsezbjuhcWajXK1Pf 5PrW7bQSjw23Nf4+dfWWwDPDGrjGxS8Ku/3Ne7XoAsD90oitgqUwpElndkyXUBtFYsUF f/0ubhFRWxW2mqI/VLzW+4u6YNEolFBLAFvtEc6it6pts+ZQv7KIN20Xkraq4GuUV5ph Oi7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=8MJrsDMYAtVQdjrdvBoPdReznL7tw3PSKPUxMTm178k=; b=tBjr68VR4/T/dv1peCtNH6cP1S6dfrAPJ757d4lEOuC1JEGiQxPXh0y7clJeFQnAum 1bJDJ5VkpTphokeZLeLeHN6VVgQTXIGDLZjibT8cQugSXI8/gPWx4XZAwBNxOHNNErU9 o47KERgJWmmg37v5ZrLrHc1Ti4vmefuleQSOfdjcuDCp36Z986r9JnDa+8woNjhwJjYn n26ygn+950fDMni3LEtHWOeOX3nGN0qPgsHDf76eqzTiOtRn+NHPwg++CORPHTE4FBIM kJF/5Lpi/KDt6Z3L/O5KcV3HoAF+mpA5NX0Fs8heNsbIivkf/MHlZoNOxfKwDrXhwNZ5 RbNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d16si523889eds.13.2020.11.29.23.32.48; Sun, 29 Nov 2020 23:33:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726628AbgK3H30 (ORCPT + 99 others); Mon, 30 Nov 2020 02:29:26 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8530 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725920AbgK3H3Z (ORCPT ); Mon, 30 Nov 2020 02:29:25 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CkxfW4GWzzhkS2; Mon, 30 Nov 2020 15:28:19 +0800 (CST) Received: from [10.174.177.149] (10.174.177.149) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Mon, 30 Nov 2020 15:28:39 +0800 Subject: Re: [PATCH 2/3] powerpc/pseries/hotplug-cpu: fix memleak in dlpar_cpu_add_by_count To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras CC: , References: <20201128102001.95323-1-miaoqinglang@huawei.com> <871rgby5lb.fsf@mpe.ellerman.id.au> From: Qinglang Miao Message-ID: Date: Mon, 30 Nov 2020 15:28:39 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <871rgby5lb.fsf@mpe.ellerman.id.au> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.149] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ?? 2020/11/30 9:51, Michael Ellerman ะด??: > Qinglang Miao writes: >> kfree(cpu_drcs) should be called when it fails to perform >> of_find_node_by_path("/cpus") in dlpar_cpu_add_by_count, >> otherwise there would be a memleak. >> >> In fact, the patch a0ff72f9f5a7 ought to remove kfree in >> find_dlpar_cpus_to_add rather than dlpar_cpu_add_by_count. >> I guess there might be a mistake when apply that one. >> >> Fixes: a0ff72f9f5a7 ("powerpc/pseries/hotplug-cpu: Remove double free in error path") >> Reported-by: Hulk Robot >> Signed-off-by: Qinglang Miao >> --- >> arch/powerpc/platforms/pseries/hotplug-cpu.c | 1 + >> 1 file changed, 1 insertion(+) > > This is already fixed in my next by: > > a40fdaf1420d ("Revert "powerpc/pseries/hotplug-cpu: Remove double free in error path"") > > cheers'Revert' sounds resonable to this one, glad to know that. > >> diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c >> index f2837e33b..4bb1c9f2b 100644 >> --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c >> +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c >> @@ -743,6 +743,7 @@ static int dlpar_cpu_add_by_count(u32 cpus_to_add) >> parent = of_find_node_by_path("/cpus"); >> if (!parent) { >> pr_warn("Could not find CPU root node in device tree\n"); >> + kfree(cpu_drcs); >> return -1; >> } >> >> -- >> 2.23.0 > . >