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 02335C2D0A3 for ; Tue, 3 Nov 2020 21:02:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B63F9223C7 for ; Tue, 3 Nov 2020 21:02:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437339; bh=UjwfcWSfJvnDSsyTrpo2npmVDrwoABCz4/fzHU1md+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=OD7C/LuHu8eZIu91weSAA/dapoBf4viu/U83uaxra+EI7leQWXW2GCxG6j4PI0MCR wQ2Qre3Su2gv8v9TVy7TxPuQhyMgRqlQxTRq8TD7oyHdMzbYNWlAtk+HwLn7yaEuks qMconfRza27hSM0PM17AyPN0JKUVEYSBOhEZhQPs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387612AbgKCVCS (ORCPT ); Tue, 3 Nov 2020 16:02:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:39310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387607AbgKCVCS (ORCPT ); Tue, 3 Nov 2020 16:02:18 -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 5C7D6205ED; Tue, 3 Nov 2020 21:02:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437337; bh=UjwfcWSfJvnDSsyTrpo2npmVDrwoABCz4/fzHU1md+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YJek5NyoywPvTLcIPVNrQ+NnQouNG4JNvsyWCRJVcb/qEAtaN6g8RKNcPtJLmTrUo fVhGbx/Q22FltoCNA2oCmYGA4F/cRfVnmkhk5ELieb584PJ0VaHORqTQJLPripP/B/ L9SPMuApW2r4bjuTIJFAm9BioCiHrjUDrPIp3Cl8= 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.19 006/191] efivarfs: Replace invalid slashes with exclamation marks in dentries. Date: Tue, 3 Nov 2020 21:34:58 +0100 Message-Id: <20201103203233.485316544@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203232.656475008@linuxfoundation.org> References: <20201103203232.656475008@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 @@ -145,6 +145,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)