From nobody Fri Apr 3 04:35:25 2026 Received: from canpmsgout02.his.huawei.com (canpmsgout02.his.huawei.com [113.46.200.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC4F02BE630; Wed, 25 Mar 2026 02:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.217 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774407455; cv=none; b=fhJ54v7tJOXeXlA1WqxsMUnRRQsjkwNyX4HiaqrHVaIUAYo8ddwnXZrT5sdUID6SormiD/8fudpyTivXlo5FKQyvVIV/I9FbLKGQNCSlg/Ugj2EIf3E5DxZXqlTrb6oVk+LPkOqi1a7AG2fW7FVCfL3CvkVQlPakhjWZQffr7P4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774407455; c=relaxed/simple; bh=09IymUmD7KCCXp41ica0n9FBDC5yY9EQ39FhFumWxKQ=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Pyd3iouiALG4yQZq+Ro8dWTL1c2aJx9bgIah2POXwME9ejUgtTFpUv5v9U/Il+DQbrUDiE5Hvq8dYEQCh3CZ5PBK4ipSLCnvuDlol0ZKc/gIhdHt4D1NKfx0I4JpMjXfHCoRcmhLpQtkSiAe05lDkpDatdZAGWl+84n8kM8mfKQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=ivD1fPbT; arc=none smtp.client-ip=113.46.200.217 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="ivD1fPbT" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=/i6VxgmNfg5cptySEU9CsbiBxFSCKM3OfYrwIMNa32Y=; b=ivD1fPbTzEYIJATMUPqbbryzgl7/XSZpHThXqBefheozkff0gSztd7U9PEHTUquuHnasS9xc2 mfTtj6jOikZBW+4M7XNr7Mn9Kz/8Fosc1CbU1SZGOjMp8hXNmqG/SEzSLJ+0fWa03btTTiY+eqQ 6UVj+DXWUth+j08yU/82eDs= Received: from mail.maildlp.com (unknown [172.19.163.104]) by canpmsgout02.his.huawei.com (SkyGuard) with ESMTPS id 4fgWdR3gZmzcb0r; Wed, 25 Mar 2026 10:51:39 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id CFB984056A; Wed, 25 Mar 2026 10:57:30 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Wed, 25 Mar 2026 10:57:27 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v10 2/8] powerpc/crash: Fix possible memory leak in update_crash_elfcorehdr() Date: Wed, 25 Mar 2026 10:58:58 +0800 Message-ID: <20260325025904.2811960-3-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260325025904.2811960-1-ruanjinjie@huawei.com> References: <20260325025904.2811960-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To dggpemf500011.china.huawei.com (7.185.36.131) Content-Type: text/plain; charset="utf-8" In get_crash_memory_ranges(), if crash_exclude_mem_range() failed after realloc_mem_ranges() has successfully allocated the cmem memory, it just returns an error but leaves cmem pointing to the allocated memory, nor is it freed in the caller update_crash_elfcorehdr(), which cause a memory leak, goto out to free the cmem. Fixes: 849599b702ef ("powerpc/crash: add crash memory hotplug support") Signed-off-by: Jinjie Ruan --- arch/powerpc/kexec/crash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kexec/crash.c b/arch/powerpc/kexec/crash.c index a325c1c02f96..1d12cef8e1e0 100644 --- a/arch/powerpc/kexec/crash.c +++ b/arch/powerpc/kexec/crash.c @@ -440,7 +440,7 @@ static void update_crash_elfcorehdr(struct kimage *imag= e, struct memory_notify * ret =3D get_crash_memory_ranges(&cmem); if (ret) { pr_err("Failed to get crash mem range\n"); - return; + goto out; } =20 /* --=20 2.34.1