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 B1E67C56201 for ; Mon, 9 Nov 2020 13:49:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 58178206B2 for ; Mon, 9 Nov 2020 13:49:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604929746; bh=QPDitiwk1e0uTubLFjFO0gM5Pz3/FzAyD3oDhoEkEDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Wk9+Ke806IVReFXw6yJu4n1j8tod6aXUCP7OW49Q5v8as+H0O/ksDkQZCvHIx5g7D UVt1QWegveNiXlZjw7lOM2sp9slz+Do8zXUyjFGmqmvBTFtDlRDRjpJDWHDrFJsbOO psW4ttCAYT65nG+GY73HJ04CkhRAsHUs0sw8Dh/0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729650AbgKINtF (ORCPT ); Mon, 9 Nov 2020 08:49:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:50910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729658AbgKIM4B (ORCPT ); Mon, 9 Nov 2020 07:56:01 -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 4B8762076E; Mon, 9 Nov 2020 12:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604926560; bh=QPDitiwk1e0uTubLFjFO0gM5Pz3/FzAyD3oDhoEkEDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pr2kNjcl7m2H0UZdeqjK+A6WBO/TqBBbt6zURtdg5KR06ye62YlnVFeVtEzyHOvsv ppv2wQVe6QmpSBb0AUnoJp1duSIu5VLXmdJ2pHJ9yrn1CuFsXme8PGA+RzWkL36KfJ QMk6++nl6J6Lg+uFWufAmlT+tyFPx40Qg3x33oyw= 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.4 04/86] efivarfs: Replace invalid slashes with exclamation marks in dentries. Date: Mon, 9 Nov 2020 13:54:11 +0100 Message-Id: <20201109125021.071442087@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125020.852643676@linuxfoundation.org> References: <20201109125020.852643676@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: stable@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 @@ -147,6 +147,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)