Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3176549pxu; Sun, 29 Nov 2020 17:55:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwqYL6ZB2jxxLr1jrEc6s507T5fhr4799OoNq/ZoqUvDw1Opeg0wHBRtYFNm/Gpc/FYTfMC X-Received: by 2002:a05:6402:1803:: with SMTP id g3mr2126021edy.360.1606701333128; Sun, 29 Nov 2020 17:55:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606701333; cv=none; d=google.com; s=arc-20160816; b=B4DdlfqXinfTNjezjrwpd7Y9X2kkuwstjGjijQiMREsrrE1VF2qrq+a1Qc054GmLGG hF+Ff1f9+ycEbd4XwC0OgAL4whZjrOYur0et0MYHFa+zFa/CLjhBahDkRVH+zCmHNGgi 5KSy2HJQfogUFQ99Wb0uegZDFNmLpAB3r+R2BewWbJqWv4SquyHvPHjWvOWRsAYHby2T 4vVkBSOTZPf5lDJxDTqXAx8IOAms9dl90I1HI/A8PoB19tfvD0SbVA8vEgp0RflErCnq XBtafE6qjUsYBOixztNTU568jW6aLwsvE7o8KvnRnThJMHw5S++JtJwk6yXPKYZep4wx sw4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=Ty8oUZkO2DpIFbIZXObOANqmbIsMDJRb/eGbdExdHXM=; b=tWiyZYN+EI0020FFtSIOGN40g+620hf5aMZL2Xg5oytdUdrtOR8Q/Itc3tVSTxNcuH ekDC02PlRwvrm2IHzWlQREar/4knN24grAYLUIvBoOa8xyZxcFNJemsPQQMvu8RVDOOG WiN/jop8lZ5kNFyxQbyj5y37ntjJBwavcq1lEKReUZc9vB9ZRqxDxCjDamDHJH8o9Ub5 6rw4DG1BJh380ZGhojTf0IF+C/44qQYxIChEXXlD3lFcE0FieAeZMwd/Sqtetst+3iaG g3vN8COlYXH2yWBqN9ogcsMawvexZITR3tK+6LVOzdRytm1/T8FligtGVGwLehMRGNwd Ja2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=oGYp8psM; 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 ce21si7663533edb.306.2020.11.29.17.55.08; Sun, 29 Nov 2020 17:55:33 -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; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=oGYp8psM; 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 S1726521AbgK3Bw1 (ORCPT + 99 others); Sun, 29 Nov 2020 20:52:27 -0500 Received: from bilbo.ozlabs.org ([203.11.71.1]:33813 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726299AbgK3Bw1 (ORCPT ); Sun, 29 Nov 2020 20:52:27 -0500 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4CkpB92ch4z9sVD; Mon, 30 Nov 2020 12:51:45 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1606701105; bh=xlIwgzjEPzyGOCP0bGlo84nJNsiFMwgliSsNWMJmGPY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=oGYp8psM5s7iCfh0zl1U86fugKwvbASdl8DteUCKa2vvvMf2Cj005dkMUX5VcDclt qnDlMQRu+2n1LKZD37QeFsmkVkHQeTaqSRF/K5vW3Fpm1GLzm+pIdfbBFXakuRT6+7 7IrTzA03pca6fSkBoqdTzgicOKZ2O9ALaB19NAU9dTlN1NvqLgxloYM/fSAKJ3rXli ur4KdHEQQvMMIRbPIg64Or3epMyKM2Pgb4fGOs5JOaeiwt7GEduSJHujY8uKpL96c+ 9W/a6l9V6IG5Njgn7JQBHhq8rnCSG03PMgdi52yVgGSRhNP/D7ZDCutp8vAUJvaky6 HNKYpkrKdHMSQ== From: Michael Ellerman To: Qinglang Miao , Benjamin Herrenschmidt , Paul Mackerras Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Qinglang Miao Subject: Re: [PATCH 2/3] powerpc/pseries/hotplug-cpu: fix memleak in dlpar_cpu_add_by_count In-Reply-To: <20201128102001.95323-1-miaoqinglang@huawei.com> References: <20201128102001.95323-1-miaoqinglang@huawei.com> Date: Mon, 30 Nov 2020 12:51:44 +1100 Message-ID: <871rgby5lb.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > 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