From mboxrd@z Thu Jan 1 00:00:00 1970 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 EC7F0C4708F for ; Thu, 3 Jun 2021 02:18:09 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BC69A613E9 for ; Thu, 3 Jun 2021 02:18:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC69A613E9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3FA2B82AC3; Thu, 3 Jun 2021 04:18:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="pEOt/1iN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 332DE82AF6; Thu, 3 Jun 2021 04:18:05 +0200 (CEST) Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 95C5B82052 for ; Thu, 3 Jun 2021 04:18:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masami.hiramatsu@linaro.org Received: by mail-pj1-x1029.google.com with SMTP id k22-20020a17090aef16b0290163512accedso2591097pjz.0 for ; Wed, 02 Jun 2021 19:18:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=k+ALdPQaSQs38Qx4jNcs76yJLYC/lks840M8CKNJboo=; b=pEOt/1iN5ZUjs6MHRrtJWgUArUkpopM9ES88jrCMCIsPEltzLgqIauE7tkaC9sbd3/ PED/qMqpMzntxrtZDsHavRSiwggnHVvmScdz0qeHZorYEcoZuQK2E5ZZx9mn7liNLZvN YBgqvweb3rhBvcymOIKoJ4f99mJh+ib0sbV4nDm/hVjORqrHtmKzOjrN8hDlOkh0HAft Kbjcx1Edr3QOKDdILPHokjszCBJPpgCmtpuc7g1yb4xr+flURyWcZJtE5IwvqQv8WNMT F0PJh3E4YCfLf8r1RtfIaumSgaoTgBQrVbNibV7onDddwPbF48DLNtqebEExstWWLRT0 in3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=k+ALdPQaSQs38Qx4jNcs76yJLYC/lks840M8CKNJboo=; b=Oc7Ycje1Ngm1xG8HKCbXana2ElzTrXfWf1tvBf3OO47fLIuxla6jkRiilhIU+8apFu uZUy0+Lb9xIJoMRSLIHvzQ6y5QK6b+1QGjBIE6HhsFqJK9gq9EjdXTjocOjFfDD9LPgN cdUEgn6gcqgLsUKUDaszbDLzHRXtJyPpJTqoR8gEuhAxNHMFgH+HizCy8XLUER/4IGbQ WmeRFewAozITKLGohZ3Bs2W56J0X8PBuSeE2jgLwb1SKyr4y4MYSJtS0jx9HUl3TalQa /dsX3+pLhbxV1v4e9mU2juakSU/sX1nsqBXEOFn8LlvZ0CxmWhWyQ7ii9mF0BquNhzL5 1gHg== X-Gm-Message-State: AOAM532C7RLU4JcYKTJqEUp3m7Frnbst0wQ0O6m5YUsOPwEIEJhoL/nA JzAKnrY6v9F7MvEwkF3oAtH9qw== X-Google-Smtp-Source: ABdhPJwv0/Km2duzJhWYS66kSf+rQWoaRJpI5/9cIsbqo6mrUwWb13dhFO0xOHMA5CzeabpbladNjA== X-Received: by 2002:a17:90a:5990:: with SMTP id l16mr8803286pji.175.1622686679788; Wed, 02 Jun 2021 19:17:59 -0700 (PDT) Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp. [210.141.244.193]) by smtp.gmail.com with ESMTPSA id c11sm560751pjr.32.2021.06.02.19.17.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 19:17:59 -0700 (PDT) From: Masami Hiramatsu To: Heinrich Schuchardt Cc: Kazuhiko Sakamoto , Alexander Graf , Masami Hiramatsu , Jesper Schmitz Mouridsen , Simon Glass , u-boot@lists.denx.de Subject: [PATCH] efi: Restrict the simple file system protocol to support only FAT Date: Thu, 3 Jun 2021 11:17:56 +0900 Message-Id: <162268667641.382839.15360535926598237804.stgit@localhost> X-Mailer: git-send-email 2.25.1 User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean Because UEFI specification v2.9, 13.3 File System Format said "The file system supported by the Extensible Firmware Interface is based on the FAT file system.", the simple file system protocol might be better to support only FAT filesystem. There must be no problem from UEFI application to access only FAT because ESP must be formatted by FAT32 and the removable media is FAT12 or FAT16, according to the UEFI spec. Reported-by: Kazuhiko Sakamoto Signed-off-by: Masami Hiramatsu --- lib/efi_loader/efi_disk.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index 307d5d759b..f69ae6587f 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -318,19 +318,25 @@ efi_fs_from_path(struct efi_device_path *full_path) } /** - * efi_fs_exists() - check if a partition bears a file system + * efi_supported_fs_exists() - check if a partition bears a supported file system * * @desc: block device descriptor * @part: partition number - * Return: 1 if a file system exists on the partition + * Return: 1 if a supported file system exists on the partition * 0 otherwise */ -static int efi_fs_exists(struct blk_desc *desc, int part) +static int efi_supported_fs_exists(struct blk_desc *desc, int part) { if (fs_set_blk_dev_with_part(desc, part)) return 0; - if (fs_get_type() == FS_TYPE_ANY) + /* + * Because UEFI specification v2.9, 13.3 File System Format said + * "The file system supported by the Extensible Firmware Interface + * is based on the FAT file system.", the simple file system protocol + * should support only FAT filesystem. + */ + if (fs_get_type() != FS_TYPE_FAT) return 0; fs_close(); @@ -428,10 +434,10 @@ static efi_status_t efi_disk_add_dev( /* * On partitions or whole disks without partitions install the - * simple file system protocol if a file system is available. + * simple file system protocol if a supported file system exists. */ if ((part || desc->part_type == PART_TYPE_UNKNOWN) && - efi_fs_exists(desc, part)) { + efi_supported_fs_exists(desc, part)) { diskobj->volume = efi_simple_file_system(desc, part, diskobj->dp); ret = efi_add_protocol(&diskobj->header,