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=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 AE47AC388F9 for ; Sat, 31 Oct 2020 11:47:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7381A2065D for ; Sat, 31 Oct 2020 11:47:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144855; bh=G3P4MoamZRbhF09JUZQrLzlhHsn0SlkUTzcqxSWXGS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=nZARU2LGzYdysun88hpzybZOiZkIsEjhWl/kQ70E51JETUFhvv/mWJsDAP+w2hRAf gMo51Rh7HRqOxfPA7OmaHd96d0S8BNXeHpVEpdPXDdLllOwIbU5arlBt3i2OhqJcfe 2meSHPpKU8XwDAP2p2VadlG9pMG3lDengJD4hhes= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728245AbgJaLp1 (ORCPT ); Sat, 31 Oct 2020 07:45:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:46398 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728005AbgJaLpY (ORCPT ); Sat, 31 Oct 2020 07:45:24 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3010B20739; Sat, 31 Oct 2020 11:45:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144723; bh=G3P4MoamZRbhF09JUZQrLzlhHsn0SlkUTzcqxSWXGS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MLp73RSf7SibyGFnrHtOHBQ4sfaK4z4UE3hMXronb/kuExXn8UW6l60EoUd8m4I2m ypUou2MEARhJAOxJTPvH4xdL6KfcO/otxIQN126PwisZpC+ObU9Gk7ShxAdK1BQX0+ y7CqyesKB9BD6jp9eQAmzvJ+DLmIabA5q+1qwLfw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Schaller , Ard Biesheuvel , dann frazier Subject: [PATCH 5.9 26/74] efivarfs: Replace invalid slashes with exclamation marks in dentries. Date: Sat, 31 Oct 2020 12:36:08 +0100 Message-Id: <20201031113501.301392049@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113500.031279088@linuxfoundation.org> References: <20201031113500.031279088@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Schaller commit 336af6a4686d885a067ecea8c3c3dd129ba4fc75 upstream. Without this patch efivarfs_alloc_dentry creates dentries with slashes in their name if the respective EFI variable has slashes in its name. This in turn causes EIO on getdents64, which prevents a complete directory listing of /sys/firmware/efi/efivars/. This patch replaces the invalid shlashes with exclamation marks like kobject_set_name_vargs does for /sys/firmware/efi/vars/ to have consistently named dentries under /sys/firmware/efi/vars/ and /sys/firmware/efi/efivars/. Signed-off-by: Michael Schaller Link: https://lore.kernel.org/r/20200925074502.150448-1-misch@google.com Signed-off-by: Ard Biesheuvel Signed-off-by: dann frazier Signed-off-by: Greg Kroah-Hartman --- fs/efivarfs/super.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c @@ -141,6 +141,9 @@ static int efivarfs_callback(efi_char16_ name[len + EFI_VARIABLE_GUID_LEN+1] = '\0'; + /* replace invalid slashes like kobject_set_name_vargs does for /sys/firmware/efi/vars. */ + strreplace(name, '/', '!'); + inode = efivarfs_get_inode(sb, d_inode(root), S_IFREG | 0644, 0, is_removable); if (!inode)