From patchwork Sun Apr 26 19:49:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 206378 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A104C54FCB for ; Sun, 26 Apr 2020 19:49:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DCCE8206BF for ; Sun, 26 Apr 2020 19:49:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=gmx.net header.i=@gmx.net header.b="QGQ8lVY0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726177AbgDZTt5 (ORCPT ); Sun, 26 Apr 2020 15:49:57 -0400 Received: from mout.gmx.net ([212.227.17.21]:46519 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726171AbgDZTt5 (ORCPT ); Sun, 26 Apr 2020 15:49:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1587930592; bh=f8Rl3upU2cRQsGsRVWr741bAGe6+dxkQS+/WJM7bXJU=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=QGQ8lVY0i5tohLKOoVD3RJ0dSObw6G0GpmvsxCGFaTfXCevQHMgz5Oa9NC5rDQx6b 0cqpCbY6m/ebxrRDFo5t4HEdZ/9VyWMB6crL9TOGaM0OcfIxTY43Gq1i+o+CsR0UKW Nc/LyBIKoZ9k+OaE6IVIUYWA90OGiPFLebm8hjfc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.119.33.226]) by mail.gmx.com (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1N6bfq-1j8EAA1Zd8-0185iK; Sun, 26 Apr 2020 21:49:52 +0200 From: Heinrich Schuchardt To: Ard Biesheuvel Cc: Ingo Molnar , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Heinrich Schuchardt Subject: [PATCH 1/1] efi/libstub: setup_graphics() do not return random data Date: Sun, 26 Apr 2020 21:49:46 +0200 Message-Id: <20200426194946.112768-1-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Provags-ID: V03:K1:KBERLvPF/oK8jHQChRbe2qHTupabdkJ/eSIrpQk9wQfiJYoEQPT /ypp3Bk3MHszy/3Icl6IHppfMWcRomEnXCjpb5oG1MceoqmaOdTGO0gRdp2lLEaPfQyTGbY AQPZgDOvNQ1Cpf3HYeVg8kdbtxsjQ75EmmmK+SumJTPlGFfCIWPiLed1l7cz1vytklOotK8 1urWoVx/SwKqV+17xbzMA== X-UI-Out-Filterresults: notjunk:1; V03:K0:6JXg6lru20U=:f67Vjgkza4wfqij7pu58ky Y0LxYPJNuZPS7LxoPL2NzLSxKGAoYJs689zXD/wlp5iX8q2ArpYLcJn5cqfQbVRnM6778QR7j 0stcc79LXLamcJ+gmgIL7gTNXtCO8QkcUgXdvE9cCBtsv+L31gatSHaxHyltCftY2hAHepZpQ 0T40A167fUMeIyUxEW0TlVAWhABkkHdoDo+eYYcqbCvIN99QGQE2T140tE907U/RzzMnzrSSc /Ya/LFxY+VCqIrCqoiwr+Tu5nQekZvlPeeqMC5caLIhHuBGoOZtVnl4lQFO/sj7VI2OuEErdz Lh8MXMW2NY+WdTy2t/WcHxSfVF5EqUGw4L8ffe3IPxGRB4V7JTSbLph9jT+LUr7oLzC6onNx2 KW4dKVlzU1i924uM368z8umkxj2ENudJnVm47PwtJQwqcfxh9Qnk9Nuy0Beupxp+hpDnd17qT 2/+k9Hh+ZsjAqrzRNfS1G2j9ai+k3oSDhueNfM800bTYyZkIC1xJjEbgaNFqtcu/QyTizLgbh C/OSpyL5FYj5tQtF5yhLB+jnlAVNMjBTY1i9muMqeS8c7EvdtwOtmfoIU+7nQIu0jWUFzSI2I zQnJPOUUiVhmbOA4y9PVaOW6n7nwxaxrYcaE6d/VFSvE8+2JkSDwzshk1od4IX8sfgQiD2SCr r5ZlcqpK1b9kd12bqLijE7gGNHlrQ9lL524W0d8VJPMq5sbOosOIzLheOFL++mrUSDsYNiz0s M8aWY0VbACltKV8RSEOrTNvGlBp8IOynqk+ans54G/d86ODbQr+vOagVeB0TDzvq+j+XZeqKc +nRx5/NJT3DdbMGCbbGQaxdqjmv8FFyN6gi9IOHLU0WcYJIQce6ioT6gUi9o/ycLFaQ6KtLDS dKA7uzw968VcDywTbl+fHM1h2CZ7hCyQir0TymYlmzyK6TFv3bGGyGLEvzAaVBQgzoZLHGqqm JtYLX4Nn66V7C6iBdsH4mjtQ9uWnnQRuAaSkXL8clRJ6ZCnlgRpQY5PESYZKI9QA4Coz7q0KT Eh0DNP1W/Ykk/Z9G9nID3/RLjlsyPfkZQM1LLrKrgqn0D0Fy22HOar9dKZ7DZ5lvnm3aFSj3b 3CQEO7mEOvls+swDDkqf6p1/YPREur4pK5Rg78o1Yx8Ry0poH9QoDI6atHQCluPffuGlf+2O7 mru8fRx/yZIwyR0jnj6u5sFePj/2Qk/u3GI8nYPZ4pBeUxe5A1TBtKDoBEc3GQZJm0irtdk2E +fFLcuRhiOOVds5SW Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Currently setup_graphics() ignores the return value of efi_setup_gop(). As AllocatePool() does not zero out memory the screen information table will contain random data in this case. We should free the screen information table if efi_setup_gop() returns an error code. Signed-off-by: Heinrich Schuchardt --- drivers/firmware/efi/libstub/efi-stub.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.26.2 diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c index ee225b323687..60377e5ceab3 100644 --- a/drivers/firmware/efi/libstub/efi-stub.c +++ b/drivers/firmware/efi/libstub/efi-stub.c @@ -55,7 +55,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; }