Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795025773; b=FmFozEtfktjBh76IRKPVG/2YxQ+ycJ2d3Oa8tbhpaeeRx9rBILMmeDlyRMpc4tSVSg7A FDhD/D4Xfw20+/25IFA03D5I8LKmVmvoIzJBWKxwAP9hH/72QgumqhAW7/VNJEbBJ8wYR ytXUi+r5aByn9aEyzZ15J+0ZcO1/s3KVcSJpWIH8UfR3skjQ9uE1bwHyBBRHOTbf4UF// zEYCHcLaPFvZSA+gQKw9jF/tfMoEVsWEa35BgZdX0rtAJO/FBtRzTLo7NJwhBNndV/WIe z6yRufS3qWkN6GXnBo+dQwC+Tav3HSr6h/a0QRkRDpgS7UwyKHaeExlMkDE3r4w3ipg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795025773; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=3lqoq7WwjxKo4m8Zhw79qtXgrZqZxTiIht1H2E87a8k=; b=swQZq7OvAFcifayjLWDNZ7ncAczcrISC8dETlqqbkEfvavvN+k4zH+QE8ZjIQKHbi56L j4kxvoLF9qOcQYm0McdpYyX0MoWYCmMDglOxo5+1zbbNOHQUPeBeV7pUzpPuZHTA/TOVo 6Io88Ejv7T+rgv0/u2u1Jw3hRVarrF5T3m8PZVW7M78N7FsbL3G1VUPnmFpNETkHDsmiI ajTyznkYxcnqwRW7KUKCEFj/PjinaoFc/tPR7Sl7qvAFTozxyhr0jT6JwqBgTI4MXmto/ 4+ejbQwlNzucN4C2QM3zZ1zUUS4hDM/Eo4CGixEdK9EcQyYA3daeXQOKDk3x0b3mKMg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=KS+Bdli0; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD7A560A260F; Wed, 18 Nov 2026 18:16:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=KS+Bdli0 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 253F51F000CB; Wed, 18 Nov 2026 18:16:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795025773; bh=3lqoq7WwjxKo4m8Zhw79qtXgrZqZxTiIht1H2E87a8k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KS+Bdli00EQhUW8QJfQYZZ3WmUXNftzCYcnbXSAFsnk0Bmcm+HLNr0DkXwsiDl9XQ OoZ0af2R4lKbao+Z76/f65vu+ljEIcOxpUqRmna+eRA5Qt4hwRwGMwlF6G24FsOwjw eMhEDA3Ac4OFwvtWn+N+mm8JoUXF0XYJaEDqmXwY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jason Gunthorpe , Ard Biesheuvel , Sasha Levin Subject: [PATCH 6.18 1156/2151] efi/libstub: Free cmdline_ptr in efi_pe_entry Date: Wed, 18 Nov 2026 15:48:11 +0100 Message-ID: <20261118150204.285161819@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150121.603863898@linuxfoundation.org> References: <20261118150121.603863898@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jason Gunthorpe [ Upstream commit 8ea857a2bb547e388e86ca42c58a97e162e09f83 ] Sashiko points out that efi_handle_cmdline() allocates this memory and hands it over to the caller. If efi_pe_entry() ever returns it should be freed. Add a __free annotation. Fixes: 42c8ea3dca09 ("efi: libstub: Factor out EFI stub entrypoint into separate file") Signed-off-by: Jason Gunthorpe Signed-off-by: Ard Biesheuvel Signed-off-by: Sasha Levin --- drivers/firmware/efi/libstub/efi-stub-entry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/efi/libstub/efi-stub-entry.c b/drivers/firmware/efi/libstub/efi-stub-entry.c index 2ebb81fd9f42a..06934278677d6 100644 --- a/drivers/firmware/efi/libstub/efi-stub-entry.c +++ b/drivers/firmware/efi/libstub/efi-stub-entry.c @@ -36,7 +36,6 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle, unsigned long image_addr; unsigned long image_size = 0; /* addr/point and size pairs for memory management*/ - char *cmdline_ptr = NULL; unsigned long reserve_addr = 0; unsigned long reserve_size = 0; @@ -58,6 +57,7 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle, return status; } + char *cmdline_ptr __free(efi_pool) = NULL; status = efi_handle_cmdline(image, &cmdline_ptr); if (status != EFI_SUCCESS) return status; -- 2.53.0