Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp498935ybr; Fri, 22 May 2020 11:35:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaZeE/RDlgftsoJNuRypefqLfuUXgKnPqC017rklBu1FgQa3I7y/bmvZf5LRX1n7S3sL2l X-Received: by 2002:a05:6402:4d5:: with SMTP id n21mr4008575edw.49.1590172506397; Fri, 22 May 2020 11:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590172506; cv=none; d=google.com; s=arc-20160816; b=Xuibv4NsxUQibpB8Jf1iOceErj7KRKM5PdqiQxObPWbSKPAq6/wuNwQWykq9Ew3EA8 SK7Pttp1hqklx7i8+/LDPapsBj7HJ0XAu6Us4yL+hKMhaL3KOLqO0xHktJfGVr2dngAT aFtcRjAZMhtwqVD/aHHK1j6z9bZ2bletfjYdVoGbuO3Qy4jF6S4oD80YzQBZRHiCPcXD qxzRn7ux2lKwhOdfa+AO+vZnT8wLzncWFpL2MzBs78pvAAHN5byfoHSALj5HZT6mn98W lJCmAIbGjeyNQttuXpG3Qs6S/Dac6/xJhZz6LO1fR2l4G0z5liXgA/o3WERt4CJSYzWU o90g== 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 :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=aot+frhSEsZI0vvh5yJCuvsg+eEesN14Qu/i0ACu02I=; b=ZX6pGx54oirXHimxD0cuYnMlRcahhfQx+SlhGYKrXNJK3v53Mmw+Aug0IzTEv56XK/ qC/onUcUh/iD+wfzzuFSu5A73fU5PONSosImyeXW5bAxIqO+YKfC9Q4FFUX1htpje4hS 4iZhNGW3M+zCcFMQl0DqQOvTMPQYRvirCIkSAU27DALx1OadGTIZUBLDD+Gby9pTu/zk M/LoKaQcnDZNvT04wLFNvJxlixki7uklsubpwdt0IQq9S3wErSLYGep9TYSIH1Hb0knB yxDpOY5/gfYVjum752x+86IE7p4gYBoXLgieM2Kgcw9PAywcu5DJ06nOoHSWly4sPqfV CNFw== ARC-Authentication-Results: i=1; mx.google.com; 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 e24si5371201ejh.298.2020.05.22.11.34.43; Fri, 22 May 2020 11:35:06 -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; 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 S1730975AbgEVSaj (ORCPT + 99 others); Fri, 22 May 2020 14:30:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730878AbgEVSaV (ORCPT ); Fri, 22 May 2020 14:30:21 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09018C05BD43; Fri, 22 May 2020 11:30:21 -0700 (PDT) Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jcCR0-0002m7-OV; Fri, 22 May 2020 20:30:18 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 260831C0095; Fri, 22 May 2020 20:30:18 +0200 (CEST) Date: Fri, 22 May 2020 18:30:18 -0000 From: "tip-bot2 for Heinrich Schuchardt" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: efi/urgent] efi/libstub: Avoid returning uninitialized data from setup_graphics() Cc: Heinrich Schuchardt , Ard Biesheuvel , x86 , LKML In-Reply-To: <20200426194946.112768-1-xypron.glpk@gmx.de> References: <20200426194946.112768-1-xypron.glpk@gmx.de> MIME-Version: 1.0 Message-ID: <159017221803.17951.10197779349789381116.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the efi/urgent branch of tip: Commit-ID: 081d5150845ba3fa49151a2f55d3cc03b0987509 Gitweb: https://git.kernel.org/tip/081d5150845ba3fa49151a2f55d3cc03b0987509 Author: Heinrich Schuchardt AuthorDate: Sun, 26 Apr 2020 21:49:46 +02:00 Committer: Ard Biesheuvel CommitterDate: Thu, 30 Apr 2020 23:26:30 +02:00 efi/libstub: Avoid returning uninitialized data from setup_graphics() Currently, setup_graphics() ignores the return value of efi_setup_gop(). As AllocatePool() does not zero out memory, the screen information table will contain uninitialized data in this case. We should free the screen information table if efi_setup_gop() returns an error code. Signed-off-by: Heinrich Schuchardt Link: https://lore.kernel.org/r/20200426194946.112768-1-xypron.glpk@gmx.de Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/arm-stub.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c index 99a5cde..48161b1 100644 --- a/drivers/firmware/efi/libstub/arm-stub.c +++ b/drivers/firmware/efi/libstub/arm-stub.c @@ -60,7 +60,11 @@ static struct screen_info *setup_graphics(void) si = alloc_screen_info(); if (!si) return NULL; - efi_setup_gop(si, &gop_proto, size); + status = efi_setup_gop(si, &gop_proto, size); + if (status != EFI_SUCCESS) { + free_screen_info(si); + return NULL; + } } return si; }