215 lines
12 KiB
Diff
215 lines
12 KiB
Diff
From patchwork Wed Apr 28 13:54:01 2021
|
|
Content-Type: text/plain; charset="utf-8"
|
|
MIME-Version: 1.0
|
|
Content-Transfer-Encoding: 8bit
|
|
X-Patchwork-Submitter: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
|
|
X-Patchwork-Id: 1471143
|
|
X-Patchwork-Delegate: xypron.glpk@gmx.de
|
|
Return-Path: <u-boot-bounces@lists.denx.de>
|
|
X-Original-To: incoming@patchwork.ozlabs.org
|
|
Delivered-To: patchwork-incoming@bilbo.ozlabs.org
|
|
Authentication-Results: ozlabs.org;
|
|
spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de
|
|
(client-ip=85.214.62.61; helo=phobos.denx.de;
|
|
envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)
|
|
Authentication-Results: ozlabs.org;
|
|
dkim=pass (1024-bit key;
|
|
unprotected) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com
|
|
header.a=rsa-sha256 header.s=selector2-NXP1-onmicrosoft-com
|
|
header.b=Y9LhgRit;
|
|
dkim-atps=neutral
|
|
Received: from phobos.denx.de (phobos.denx.de [85.214.62.61])
|
|
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
|
|
key-exchange X25519 server-signature RSA-PSS (4096 bits))
|
|
(No client certificate requested)
|
|
by ozlabs.org (Postfix) with ESMTPS id 4FVfRz6xNvz9sW6
|
|
for <incoming@patchwork.ozlabs.org>; Wed, 28 Apr 2021 23:22:07 +1000 (AEST)
|
|
Received: from h2850616.stratoserver.net (localhost [IPv6:::1])
|
|
by phobos.denx.de (Postfix) with ESMTP id 0143180EC0;
|
|
Wed, 28 Apr 2021 15:22:01 +0200 (CEST)
|
|
Authentication-Results: phobos.denx.de;
|
|
dmarc=none (p=none dis=none) header.from=oss.nxp.com
|
|
Authentication-Results: phobos.denx.de;
|
|
spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de
|
|
Authentication-Results: phobos.denx.de;
|
|
dkim=pass (1024-bit key;
|
|
unprotected) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com
|
|
header.b="Y9LhgRit";
|
|
dkim-atps=neutral
|
|
Received: by phobos.denx.de (Postfix, from userid 109)
|
|
id 11DCC80EC0; Wed, 28 Apr 2021 15:22:00 +0200 (CEST)
|
|
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de
|
|
X-Spam-Level:
|
|
X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,
|
|
DKIM_VALID,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER,SPF_HELO_PASS
|
|
autolearn=no autolearn_force=no version=3.4.2
|
|
Received: from EUR05-VI1-obe.outbound.protection.outlook.com
|
|
(mail-vi1eur05on20614.outbound.protection.outlook.com
|
|
[IPv6:2a01:111:f400:7d00::614])
|
|
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
|
|
(No client certificate requested)
|
|
by phobos.denx.de (Postfix) with ESMTPS id BF2AE82BB2
|
|
for <u-boot@lists.denx.de>; Wed, 28 Apr 2021 15:21:56 +0200 (CEST)
|
|
Authentication-Results: phobos.denx.de;
|
|
dmarc=none (p=none dis=none) header.from=oss.nxp.com
|
|
Authentication-Results: phobos.denx.de;
|
|
spf=pass smtp.mailfrom=peng.fan@oss.nxp.com
|
|
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
|
|
b=Ykl/b+bOscXPccjkBLrnNZ64DLu+6jcykHxXg6zp1iRDn9PjYn5sAB9UzpDwBH/KBFvrw3JDaJE3H5KE1MYt/qTuXtPsUxfuHlok2cGYHW9QtYf5hVHXeWQ2CEuFUsTXn0wkc/UWBAqubidQx/AHfKQCT2TtJgSzsiaS+s0Q4xEfkByM49AF5KbOQ9dfEBqQgcpjjCPO5870sdVmZGUbHH2Alvo3NxlPP1gWLM0yVNN33b5BUxMiBgkiycAt1eN1V5lqmhkzB2i8LrKv8X+8P9n41oowUuqt0Qaai6eYOhg+bhNaZbrEUdcI47KRm5hpg1pk0sYYw+IeXo4P9EmhGg==
|
|
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
|
|
s=arcselector9901;
|
|
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
|
|
bh=Jvu1xYFUKJO/uJlsI76lQFrPlpRTiU+rjukLralExi8=;
|
|
b=fZLxEM4upa8xSPDRUr7ha1FAI2UY44OO4z3vEc15uhQcMMwddhIvqbEAMyJ9CfOjnAN3K8FzmE8uZAb5U7qqT9NqOlK0sVsPLb6rXRAIlj2lDUoPPwQ0LAzKA1A8ADxTEGJZhcy+s60JQ2mmPMgg8wf7ybi3YOHnV972Ai8EJT0dCJeEMbWJ2CjRtWZqpLyDujovr8w82q2vXpFPXMp/krwklqtTdlGxgKP9ZMU+2n0SGvqBTcXts/cE+XxraFrOTth/rdLrqKtKXGjbGGN9bW0cNJWzmYMFBwR8oU27Ygr0FZ7GFqW7pGdPaGkfjsbkqvS+8P9/4qBo208dUryMZg==
|
|
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
|
|
smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com;
|
|
dkim=pass header.d=oss.nxp.com; arc=none
|
|
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com;
|
|
s=selector2-NXP1-onmicrosoft-com;
|
|
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
|
|
bh=Jvu1xYFUKJO/uJlsI76lQFrPlpRTiU+rjukLralExi8=;
|
|
b=Y9LhgRit5KPyFtT5AVfHzHnlc9O6Ssk9T3mI7BThr15G7JYL8xyLUH1Yx3UmVl57Rvgz1z8yMTCtLyhHB3Xbw82ysiOO8JpHAM1U20AXO2mAew0td3xOPWJ7aDBS2NBdGmkM4PG9WfYlpl8TzsMDJNfjpNWiID6ykA2/FGS3Krg=
|
|
Authentication-Results: gmx.de; dkim=none (message not signed)
|
|
header.d=none;gmx.de; dmarc=none action=none header.from=oss.nxp.com;
|
|
Received: from AM5PR0402MB2756.eurprd04.prod.outlook.com
|
|
(2603:10a6:203:99::22) by AM6PR0402MB3525.eurprd04.prod.outlook.com
|
|
(2603:10a6:209:4::14) with Microsoft SMTP Server (version=TLS1_2,
|
|
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.25; Wed, 28 Apr
|
|
2021 13:21:55 +0000
|
|
Received: from AM5PR0402MB2756.eurprd04.prod.outlook.com
|
|
([fe80::b158:2ae5:f2d1:7142]) by AM5PR0402MB2756.eurprd04.prod.outlook.com
|
|
([fe80::b158:2ae5:f2d1:7142%9]) with mapi id 15.20.4065.027; Wed, 28 Apr 2021
|
|
13:21:55 +0000
|
|
From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
|
|
To: xypron.glpk@gmx.de,
|
|
agraf@csgraf.de
|
|
Cc: u-boot@lists.denx.de, pbrobinson@redhat.com, grant.likely@arm.com,
|
|
Peng Fan <peng.fan@nxp.com>,
|
|
=?utf-8?q?Stefan_S=C3=B8rensen?= <stefan.sorensen@spectralink.com>,
|
|
Peter Robinson <pbrobinson@gmail.com>
|
|
Subject: [PATCH V2] efi_loader: loosen buffer parameter check in
|
|
efi_file_read_int
|
|
Date: Wed, 28 Apr 2021 21:54:01 +0800
|
|
Message-Id: <20210428135401.22365-1-peng.fan@oss.nxp.com>
|
|
X-Mailer: git-send-email 2.30.0
|
|
X-Originating-IP: [119.31.174.71]
|
|
X-ClientProxiedBy: HK2PR0302CA0020.apcprd03.prod.outlook.com
|
|
(2603:1096:202::30) To AM5PR0402MB2756.eurprd04.prod.outlook.com
|
|
(2603:10a6:203:99::22)
|
|
MIME-Version: 1.0
|
|
X-MS-Exchange-MessageSentRepresentingType: 1
|
|
Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by
|
|
HK2PR0302CA0020.apcprd03.prod.outlook.com (2603:1096:202::30) with Microsoft
|
|
SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
|
|
15.20.4087.16 via Frontend Transport; Wed, 28 Apr 2021 13:21:52 +0000
|
|
X-MS-PublicTrafficType: Email
|
|
X-MS-Office365-Filtering-Correlation-Id: d16d4712-33ca-4f2f-49cf-08d90a489784
|
|
X-MS-TrafficTypeDiagnostic: AM6PR0402MB3525:
|
|
X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True
|
|
X-MS-Exchange-Transport-Forked: True
|
|
X-Microsoft-Antispam-PRVS:
|
|
<AM6PR0402MB35250A339D51FF374D7AE862C9409@AM6PR0402MB3525.eurprd04.prod.outlook.com>
|
|
X-MS-Oob-TLC-OOBClassifiers: OLM:1091;
|
|
X-MS-Exchange-SenderADCheck: 1
|
|
X-Microsoft-Antispam: BCL:0;
|
|
X-Microsoft-Antispam-Message-Info:
|
|
R8IIzR87BJ9qITheAW0/6SscIznIBDQntrQKYiITRtr3RZNBHPGuiexfqYuAABypLYa20Kpjk8qwFtkVl5Wv9zswD2NHqy5w+BU9PNQDIw5/spSSuSNZKUBD9L1rsFxNX+pluafaP2yEzJ09OmA1rGVbLC8uc0VtwPFvuyXoPYvMI8nbxEuX8eVVs8oz6i8qTLMzAKJS7PgYVwBQQjkqPEAwfnkSibtgFyy2rBjeD18PGmRSKqwkNWkO7w3bBkj/7Zor9h/8j8w07q+Iq/ZU1Mlbm8USlj2VCmhqkJddRE7/Jj0NMfQLQJ3zZABeONnYzgAUfyXXQb4sxuuM+nqRwyW/oASjsumXU4sApadRppYdLqA2uxrvM7HduDA16u1YIOc7exaHsHSuZm3p0jnKSbUkDWki3YwYZYKuOSAhwVnxIFzdFO331d/JoJnvCPulh43Bf2ndcJ+Fi6UK/BPtUCHjzSvXm5SWO2YlsNW6EAQf/teSOpYzo6jQT3QLS5InHcfHTUBcF7z7679ht2IGrNZZc2gq/Z5eCppzp33pHTx+R+wqWt+vDU8+iho2jR4+UoTTC2VanZ8dprckWpPXxgtPq6ZbkmFKjdql5ZZWwMfKu/0DaKI+T0Qcrgo5BUNETfCuDu48gBkMrs+ewk5JWR4u9Dwgq605ea1ydic2+X7SoTc/ZQ1mnr+P5IBaTsdJxE4rLVKGAo5HZcS7X6t2b9RSQz2CTskNOlg9t+2XE0zvDc19T8CF6rTS8DkG4yQa
|
|
X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
|
|
IPV:NLI; SFV:NSPM; H:AM5PR0402MB2756.eurprd04.prod.outlook.com; PTR:;
|
|
CAT:NONE;
|
|
SFS:(4636009)(136003)(39860400002)(376002)(366004)(396003)(346002)(38100700002)(38350700002)(478600001)(5660300002)(6506007)(6666004)(66574015)(26005)(6486002)(86362001)(956004)(66476007)(2906002)(16526019)(83380400001)(6512007)(1076003)(8676002)(966005)(54906003)(186003)(52116002)(66556008)(66946007)(4326008)(316002)(2616005)(8936002);
|
|
DIR:OUT; SFP:1101;
|
|
X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?mYfVlOJMJVsoKYMLc92rFnaCTR+XLQ?=
|
|
=?utf-8?q?NE9Fknv0C/Xkfupn634/z0PDINPn1vwI7UBh2GXDundoV+tDpV3/J9Ao+ZaklGBv/?=
|
|
=?utf-8?q?35YvbogOLThhUOpbrxM2+PmyMASh2BwZQm4j3DtGuxerW2benG82zAGjtAJ70va+R?=
|
|
=?utf-8?q?fdHJfMOIDL+Oxkvqa8F1tiAWyVebMmTb9LvZQdnkJtClzsGEsN7JuXzN5zAG9JnDk?=
|
|
=?utf-8?q?ptt4s0xR8Tngwj+0ktYv/WIYfWbyVRKt2cGY+IbfGzOgHeeR/6msyKEXY6EKxdrGp?=
|
|
=?utf-8?q?ddqp/uOGuH2BlhbQtqWthQJBCUI+HaR7mZgiEJctgT+rWAg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TPnrnqM0ajr5/9bMQ4Qd?=
|
|
=?utf-8?q?Ar+eZL4d88AuBRbax/JmKGSxLCxUVyAjXtrcEnoibNf1yLZlcgAp8kEaK1mMOh2B7?=
|
|
=?utf-8?q?UflHobGwDKQKgP5I34mBssnm96TCDU6t+rHhProt6OgOKQPoQ5gmKvQx5CBsVuTA0?=
|
|
=?utf-8?q?3gJ4gCfW4myFky?=
|
|
X-OriginatorOrg: oss.nxp.com
|
|
X-MS-Exchange-CrossTenant-Network-Message-Id:
|
|
d16d4712-33ca-4f2f-49cf-08d90a489784
|
|
X-MS-Exchange-CrossTenant-AuthSource:
|
|
AM5PR0402MB2756.eurprd04.prod.outlook.com
|
|
X-MS-Exchange-CrossTenant-AuthAs: Internal
|
|
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Apr 2021 13:21:54.9886 (UTC)
|
|
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
|
|
X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
|
|
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
|
|
X-MS-Exchange-CrossTenant-UserPrincipalName:
|
|
kJtC/i3wLmUtXCoTbf/Jg1qhdz4MvWusai7Piwigv6OEGOknbKvDpIUrRwJMUXhNsSApid+ni8lC5sO+x5y30w==
|
|
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3525
|
|
X-BeenThere: u-boot@lists.denx.de
|
|
X-Mailman-Version: 2.1.34
|
|
Precedence: list
|
|
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
|
List-Unsubscribe: <https://lists.denx.de/options/u-boot>,
|
|
<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>
|
|
List-Archive: <https://lists.denx.de/pipermail/u-boot/>
|
|
List-Post: <mailto:u-boot@lists.denx.de>
|
|
List-Help: <mailto:u-boot-request@lists.denx.de?subject=help>
|
|
List-Subscribe: <https://lists.denx.de/listinfo/u-boot>,
|
|
<mailto:u-boot-request@lists.denx.de?subject=subscribe>
|
|
Errors-To: u-boot-bounces@lists.denx.de
|
|
Sender: "U-Boot" <u-boot-bounces@lists.denx.de>
|
|
X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de
|
|
X-Virus-Status: Clean
|
|
|
|
From: Peng Fan <peng.fan@nxp.com>
|
|
|
|
This is same issue as https://bugzilla.redhat.com/show_bug.cgi?id=1733817,
|
|
but that fix was wrongly partial reverted.
|
|
|
|
When reading a directory, EFI_BUFFER_TOO_SMALL should be returned when
|
|
the supplied buffer is too small, so a use-case is to call
|
|
EFI_FILE_PROTOCOL.Read() with *buffer_size=0 and buffer=NULL to
|
|
obtain the needed size before doing the actual read.
|
|
|
|
So remove the check only for directory reading, file reading already
|
|
do the check by itself.
|
|
|
|
Fixes: db12f518edb0("efi_loader: implement non-blocking file services")
|
|
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
|
|
Cc: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
|
Tested-by: Peter Robinson <pbrobinson@gmail.com>
|
|
Signed-off-by: Peng Fan <peng.fan@nxp.com>
|
|
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
|
|
Tested-by: Michal Simek <michal.simek@xilinx.com>
|
|
---
|
|
|
|
V2:
|
|
Update commit log Per Heinrich's comments.
|
|
Add T-b tag
|
|
|
|
lib/efi_loader/efi_file.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c
|
|
index 204105e25a..6b3f5962be 100644
|
|
--- a/lib/efi_loader/efi_file.c
|
|
+++ b/lib/efi_loader/efi_file.c
|
|
@@ -554,7 +554,7 @@ static efi_status_t efi_file_read_int(struct efi_file_handle *this,
|
|
efi_status_t ret = EFI_SUCCESS;
|
|
u64 bs;
|
|
|
|
- if (!this || !buffer_size || !buffer)
|
|
+ if (!this || !buffer_size)
|
|
return EFI_INVALID_PARAMETER;
|
|
|
|
bs = *buffer_size;
|