Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2638988pxa; Mon, 17 Aug 2020 15:10:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaLi3NEmBrnSGcVg3wiWVI2/flc92U71DKjoTnIuWCCpzexBF9boqeN1QMKG2LfUTtvEKj X-Received: by 2002:a50:ccd1:: with SMTP id b17mr16760987edj.165.1597702213933; Mon, 17 Aug 2020 15:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597702213; cv=none; d=google.com; s=arc-20160816; b=Vz09UH1dpdAEglxSn2DgM/RX4bq6EyeY6NNk8CnfSA8jFu62aLRGYNYqnCqSf1kfRQ X+1IDn/K6JOJv28mDEHXanONCfP6f4U7opwx0/XNhGmsP65phw7NGj8L4QQW0EBbAnKr CePKGozDk22Z/HVs5LwNdvYHBOqCw1sWcQk6rPlFyREsxl22hMsIhRupc+DLzU1ygFNH iYQsDWxYjwgsPl8LJSlBxq3enfvph3QExF3wi//YSb6zhkzIvMWjM4CfHJMsWpKS+ttn 1Z3GjZwKPyYOU1EMCo180iNQYlHJfsh4RJMVEnfQOUFncT8s+teEWkDEObgDyQ03OJhI 5bUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oTlivsZLM7/x3iI+v/XlxY5Xt/JkdAvCIvo+Uu3WH9M=; b=K6Z51aV9UgVIu3ypHm+OR3N7AQseNJ0gB4yAPZt2aRRgQAwoCk76TpM3kjQ1h+m3ck QiSp0QmJZ5Qe/u0msH9X5pz19lVyfK5Not+YPy/hKIDiaapQleIF07TPEsb/HY7HEAIw gO3BIheqcGp0SewkxbKeEzDRlelMtIZbsDS7LX28oa4UsNP3VdVipWTA/0C9oID9X5bu TrGtSx+9pFC+E60vr2lsuQ2cRUOSKvogr2FMFfmmRKKE5CjP2uMWvRoGXSMrJ/yJPdMs Bd+e+GzNUSTBW40pj8zoA/87ft4DTXPjqkEm/VGlXCwGEeZP4ggQXSVCsS0dZBkrpSbs 4cFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YfXoZKio; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b21si12144716eja.19.2020.08.17.15.09.50; Mon, 17 Aug 2020 15:10:13 -0700 (PDT) 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=@kernel.org header.s=default header.b=YfXoZKio; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388800AbgHQQ3o (ORCPT + 99 others); Mon, 17 Aug 2020 12:29:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:39666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387922AbgHQPxd (ORCPT ); Mon, 17 Aug 2020 11:53:33 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 74F9A21744; Mon, 17 Aug 2020 15:53:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597679610; bh=QNi9gv+rf5slUxfdHR740fYbHA5xhV8irPouXkkHkWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YfXoZKio5+5QYdRfmgi4acX6VtXSXBUc4cBYGjKaB0Xaq5PR8wQHE1BHz/4MALAex oTSu3rILmGti9EJGD5/TZzmrm/uc3h7wEQawKT3iwTxqc8s4RxK57nm+ZxECjpkSTc tlKzS2PK8K8P8pQvLe7AxqIs/xK48p+BBdQA4UCg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Lynch , Michael Ellerman , Sasha Levin Subject: [PATCH 5.7 273/393] powerpc/pseries/hotplug-cpu: Remove double free in error path Date: Mon, 17 Aug 2020 17:15:23 +0200 Message-Id: <20200817143832.862440119@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143819.579311991@linuxfoundation.org> References: <20200817143819.579311991@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Lynch [ Upstream commit a0ff72f9f5a780341e7ff5e9ba50a0dad5fa1980 ] In the unlikely event that the device tree lacks a /cpus node, find_dlpar_cpus_to_add() oddly frees the cpu_drcs buffer it has been passed before returning an error. Its only caller also frees the buffer on error. Remove the less conventional kfree() of a caller-supplied buffer from find_dlpar_cpus_to_add(). Fixes: 90edf184b9b7 ("powerpc/pseries: Add CPU dlpar add functionality") Signed-off-by: Nathan Lynch Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20190919231633.1344-1-nathanl@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/platforms/pseries/hotplug-cpu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c index d4b346355bb9e..6d4ee03d476a9 100644 --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c @@ -739,7 +739,6 @@ 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.25.1