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=unavailable 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 10686C2D0A3 for ; Mon, 9 Nov 2020 13:00:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B170B2084C for ; Mon, 9 Nov 2020 13:00:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604926819; bh=VFw5kgRQrJ0xbQiQbgj6KQOkQHOOJbcDZyvdw3SCgEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=A6o3scBrXidfFjRJ8DpyWm0Ga5qpADpiVV7i2+z2RZImeKYyHwYmOhTDkeH5XkXK8 drMvpSwoUsxk3y4qBrSWzCnxbyQC6j4UIxlg4jonSna7cbkzlcGC0pAxyv/KS+tmdU j2vS2ZK2HRqN5FfANZ8Cu+CJAIl0hU3z/n6sGlp4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729777AbgKINAS (ORCPT ); Mon, 9 Nov 2020 08:00:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:54298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730425AbgKINAJ (ORCPT ); Mon, 9 Nov 2020 08:00:09 -0500 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 EE70620684; Mon, 9 Nov 2020 13:00:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604926808; bh=VFw5kgRQrJ0xbQiQbgj6KQOkQHOOJbcDZyvdw3SCgEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r3oLbdi+M3yXLqo+EboKX1C/0x5pf04UwZBYkgEeNg9QgLc07Y3Gf0fVz6C0AohY9 5dJrluwGpvB97pMvmZQ3G+lBQvn+qsvZY6Q3mSpFJOKtWDqgeaGhcMdC5+xE0VPC3P NdED/44fuoOmtmX6LxDeifl0Z6yUqn+r2lTOVRNQ= 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 4.9 004/117] efivarfs: Replace invalid slashes with exclamation marks in dentries. Date: Mon, 9 Nov 2020 13:53:50 +0100 Message-Id: <20201109125025.840680317@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125025.630721781@linuxfoundation.org> References: <20201109125025.630721781@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 @@ -146,6 +146,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)