get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2218958/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2218958,
    "url": "http://patchwork.ozlabs.org/api/patches/2218958/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260402072701.628293-5-ruanjinjie@huawei.com/",
    "project": {
        "id": 2,
        "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api",
        "name": "Linux PPC development",
        "link_name": "linuxppc-dev",
        "list_id": "linuxppc-dev.lists.ozlabs.org",
        "list_email": "linuxppc-dev@lists.ozlabs.org",
        "web_url": "https://github.com/linuxppc/wiki/wiki",
        "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git",
        "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/",
        "list_archive_url": "https://lore.kernel.org/linuxppc-dev/",
        "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/",
        "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"
    },
    "msgid": "<20260402072701.628293-5-ruanjinjie@huawei.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20260402072701.628293-5-ruanjinjie@huawei.com/",
    "date": "2026-04-02T07:26:50",
    "name": "[v12,04/15] arm64: kexec_file: Fix potential buffer overflow in prepare_elf_headers()",
    "commit_ref": null,
    "pull_url": null,
    "state": "handled-elsewhere",
    "archived": false,
    "hash": "d5e6be99a361498d4ad256be36617ccec6b8642b",
    "submitter": {
        "id": 84791,
        "url": "http://patchwork.ozlabs.org/api/people/84791/?format=api",
        "name": "Jinjie Ruan",
        "email": "ruanjinjie@huawei.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260402072701.628293-5-ruanjinjie@huawei.com/mbox/",
    "series": [
        {
            "id": 498443,
            "url": "http://patchwork.ozlabs.org/api/series/498443/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=498443",
            "date": "2026-04-02T07:26:46",
            "name": "arm64/riscv: Add support for crashkernel CMA reservation",
            "version": 12,
            "mbox": "http://patchwork.ozlabs.org/series/498443/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2218958/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2218958/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linuxppc-dev+bounces-19195-incoming=patchwork.ozlabs.org@lists.ozlabs.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linuxppc-dev@lists.ozlabs.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256\n header.s=dkim header.b=m6UHo5BT;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=112.213.38.117; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-19195-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)",
            "lists.ozlabs.org;\n arc=none smtp.remote-ip=113.46.200.220",
            "lists.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=huawei.com",
            "lists.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256\n header.s=dkim header.b=m6UHo5BT;\n\tdkim-atps=neutral",
            "lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=huawei.com\n (client-ip=113.46.200.220; helo=canpmsgout05.his.huawei.com;\n envelope-from=ruanjinjie@huawei.com; receiver=lists.ozlabs.org)"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fmYLh2yMwz1yCs\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 02 Apr 2026 18:26:20 +1100 (AEDT)",
            "from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4fmYLH5m7Gz2yth;\n\tThu, 02 Apr 2026 18:25:59 +1100 (AEDT)",
            "from canpmsgout05.his.huawei.com (canpmsgout05.his.huawei.com\n [113.46.200.220])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4fmYLG5yg1z2yYK\n\tfor <linuxppc-dev@lists.ozlabs.org>; Thu, 02 Apr 2026 18:25:58 +1100 (AEDT)",
            "from mail.maildlp.com (unknown [172.19.162.144])\n\tby canpmsgout05.his.huawei.com (SkyGuard) with ESMTPS id 4fmYBp2KcPz12LF1;\n\tThu,  2 Apr 2026 15:19:30 +0800 (CST)",
            "from dggpemf500011.china.huawei.com (unknown [7.185.36.131])\n\tby mail.maildlp.com (Postfix) with ESMTPS id CC5EF40538;\n\tThu,  2 Apr 2026 15:25:55 +0800 (CST)",
            "from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com\n (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 2 Apr\n 2026 15:25:52 +0800"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775114759;\n\tcv=none;\n b=JoUFCNTUsTXUr3aGhUersczN4IHZrVZx8AAKdEVcXKgtZbVW7O3uLIn3DM2cAvSDc9LAlWX8ZxHPDj5tlTUwuSdINh1Dww9h7FsG8+hdHWJO0eYFJieMMSSrGH5m2u01h3N1+bppPgijibCYHrvnvlDbGTVlfnt8PEZeik6z+gtzd+UDhGsfnQJxkh7P1HFasFih0MjNhUbDgXJ54sUGfQEwphe/g8T6vvykYDM904dwyvCHEXjfbecRgwwH1oUtvkKoIc8RjhQe8ytqztF4cd2hx3MfpvK20EJFTNoVm7rZmuGY5vy8HEqMKeC047qldFxNVnzc9Avb9UkRE8sTNQ==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1775114759; c=relaxed/relaxed;\n\tbh=NTXaH/u2INsyIif/iORAXkaRRNdVFjs/BI5242cqFK0=;\n\th=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=NoU/ZBQsOLUnIp92ZGW0y8J+E6/NitxWVYfKtKrpfWgQrsoPxLbXB3uMqdladNuVJ2dh7l+pTPHncm3EgCdKG1dRyjxr1q1r3DSqhONNn2Vm6YCAdtaj8p9OQz21IrME8UE1xB6re0kFSONJbe253KUjVZMFb/4q7JHTih8HDYuBytxJsu4PtfO5o6xWU+fES0wQIx4WOWCL9TqJI4hFRoXgWB24wgQIW2L8/CtNk4UthVZqZ581l693V0U4rB14Otr0S2L8uAsDZqLZQSD9XRrosUoC9287ROAROrZsfDGVjYkBBQ1w1Xo6VUwrLJrWBrHFIQRFIwq2/v2Ngwem4A==",
        "ARC-Authentication-Results": "i=1; lists.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=huawei.com;\n dkim=pass (1024-bit key;\n unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256\n header.s=dkim header.b=m6UHo5BT; dkim-atps=neutral;\n spf=pass (client-ip=113.46.200.220; helo=canpmsgout05.his.huawei.com;\n envelope-from=ruanjinjie@huawei.com;\n receiver=lists.ozlabs.org) smtp.mailfrom=huawei.com",
        "dkim-signature": "v=1; a=rsa-sha256; d=huawei.com; s=dkim;\n\tc=relaxed/relaxed; q=dns/txt;\n\th=From;\n\tbh=NTXaH/u2INsyIif/iORAXkaRRNdVFjs/BI5242cqFK0=;\n\tb=m6UHo5BTrBmJCqhNfkREKY9koHpctmsQLW/KoJMDsGsK70DUBGQfH/kY0q5LTEyCfKgZhqcQl\n\tjCC4hEY1NYZChtgLRM5XhFqh4BA7Iq9CKc/uNNCrw/0Zk4f7s+QoSJidtHUnzB8swS3X8IseM2X\n\tJFczaaj7qIkblhvkhlOtpsU=",
        "From": "Jinjie Ruan <ruanjinjie@huawei.com>",
        "To": "<corbet@lwn.net>, <skhan@linuxfoundation.org>, <catalin.marinas@arm.com>,\n\t<will@kernel.org>, <chenhuacai@kernel.org>, <kernel@xen0n.name>,\n\t<maddy@linux.ibm.com>, <mpe@ellerman.id.au>, <npiggin@gmail.com>,\n\t<chleroy@kernel.org>, <pjw@kernel.org>, <palmer@dabbelt.com>,\n\t<aou@eecs.berkeley.edu>, <alex@ghiti.fr>, <tglx@kernel.org>,\n\t<mingo@redhat.com>, <bp@alien8.de>, <dave.hansen@linux.intel.com>,\n\t<hpa@zytor.com>, <robh@kernel.org>, <saravanak@kernel.org>,\n\t<akpm@linux-foundation.org>, <bhe@redhat.com>, <vgoyal@redhat.com>,\n\t<dyoung@redhat.com>, <rdunlap@infradead.org>, <peterz@infradead.org>,\n\t<pawan.kumar.gupta@linux.intel.com>, <feng.tang@linux.alibaba.com>,\n\t<dapeng1.mi@linux.intel.com>, <kees@kernel.org>, <elver@google.com>,\n\t<paulmck@kernel.org>, <lirongqing@baidu.com>, <rppt@kernel.org>,\n\t<leitao@debian.org>, <ardb@kernel.org>, <jbohac@suse.cz>,\n\t<cfsworks@gmail.com>, <tangyouling@kylinos.cn>, <sourabhjain@linux.ibm.com>,\n\t<ritesh.list@gmail.com>, <hbathini@linux.ibm.com>, <eajames@linux.ibm.com>,\n\t<guoren@kernel.org>, <songshuaishuai@tinylab.org>, <kevin.brodsky@arm.com>,\n\t<vishal.moola@gmail.com>, <junhui.liu@pigmoral.tech>, <coxu@redhat.com>,\n\t<fuqiang.wang@easystack.cn>, <liaoyuanhong@vivo.com>,\n\t<takahiro.akashi@linaro.org>, <james.morse@arm.com>, <lizhengyu3@huawei.com>,\n\t<x86@kernel.org>, <linux-doc@vger.kernel.org>,\n\t<linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>,\n\t<loongarch@lists.linux.dev>, <linuxppc-dev@lists.ozlabs.org>,\n\t<linux-riscv@lists.infradead.org>, <devicetree@vger.kernel.org>,\n\t<kexec@lists.infradead.org>",
        "CC": "<ruanjinjie@huawei.com>",
        "Subject": "[PATCH v12 04/15] arm64: kexec_file: Fix potential buffer overflow in\n prepare_elf_headers()",
        "Date": "Thu, 2 Apr 2026 15:26:50 +0800",
        "Message-ID": "<20260402072701.628293-5-ruanjinjie@huawei.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20260402072701.628293-1-ruanjinjie@huawei.com>",
        "References": "<20260402072701.628293-1-ruanjinjie@huawei.com>",
        "X-Mailing-List": "linuxppc-dev@lists.ozlabs.org",
        "List-Id": "<linuxppc-dev.lists.ozlabs.org>",
        "List-Help": "<mailto:linuxppc-dev+help@lists.ozlabs.org>",
        "List-Owner": "<mailto:linuxppc-dev+owner@lists.ozlabs.org>",
        "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>",
        "List-Archive": "<https://lore.kernel.org/linuxppc-dev/>,\n  <https://lists.ozlabs.org/pipermail/linuxppc-dev/>",
        "List-Subscribe": "<mailto:linuxppc-dev+subscribe@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-digest@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-nomail@lists.ozlabs.org>",
        "List-Unsubscribe": "<mailto:linuxppc-dev+unsubscribe@lists.ozlabs.org>",
        "Precedence": "list",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.90.53.73]",
        "X-ClientProxiedBy": "kwepems100002.china.huawei.com (7.221.188.206) To\n dggpemf500011.china.huawei.com (7.185.36.131)",
        "X-Spam-Status": "No, score=-0.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tDKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled\n\tversion=4.0.1 OzLabs 8",
        "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org"
    },
    "content": "There is a race condition between the kexec_load() system call\n(crash kernel loading path) and memory hotplug operations that can lead\nto buffer overflow and potential kernel crash.\n\nDuring prepare_elf_headers(), the following steps occur:\n1. The first for_each_mem_range()  queries current System RAM memory ranges\n2. Allocates buffer based on queried count\n3. The 2st for_each_mem_range() populates ranges from memblock\n\nIf memory hotplug occurs between step 1 and step 3, the number of ranges\ncan increase, causing out-of-bounds write when populating cmem->ranges[].\n\nThis happens because kexec_load() uses kexec_trylock (atomic_t) while\nmemory hotplug uses device_hotplug_lock (mutex), so they don't serialize\nwith each other.\n\nJust add bounds checking to prevent out-of-bounds access.\n\nCc: AKASHI Takahiro <takahiro.akashi@linaro.org>\nCc: Catalin Marinas <catalin.marinas@arm.com>\nCc: Will Deacon <will.deacon@arm.com>\nFixes: 3751e728cef2 (\"arm64: kexec_file: add crash dump support\")\nSigned-off-by: Jinjie Ruan <ruanjinjie@huawei.com>\n---\n arch/arm64/kernel/machine_kexec_file.c | 5 +++++\n 1 file changed, 5 insertions(+)",
    "diff": "diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c\nindex fba260ad87a9..df52ac4474c9 100644\n--- a/arch/arm64/kernel/machine_kexec_file.c\n+++ b/arch/arm64/kernel/machine_kexec_file.c\n@@ -59,6 +59,11 @@ static int prepare_elf_headers(void **addr, unsigned long *sz)\n \tcmem->max_nr_ranges = nr_ranges;\n \tcmem->nr_ranges = 0;\n \tfor_each_mem_range(i, &start, &end) {\n+\t\tif (cmem->nr_ranges >= cmem->max_nr_ranges) {\n+\t\t\tret = -ENOMEM;\n+\t\t\tgoto out;\n+\t\t}\n+\n \t\tcmem->ranges[cmem->nr_ranges].start = start;\n \t\tcmem->ranges[cmem->nr_ranges].end = end - 1;\n \t\tcmem->nr_ranges++;\n",
    "prefixes": [
        "v12",
        "04/15"
    ]
}