Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3185236pxb; Mon, 9 Nov 2020 05:06:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyFxkKTjV1dY1v8Iq3SH09ehhy2IQo5jX5tGZzvZYhQZGOQRFdUer1/y4yOWvBLny2j+amc X-Received: by 2002:a05:600c:214a:: with SMTP id v10mr14229824wml.20.1604927191970; Mon, 09 Nov 2020 05:06:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604927191; cv=none; d=google.com; s=arc-20160816; b=j8DRUlex5xggavjRW3lf7YOWDPnlzulR8syqTfW4fHXRhTa/5RmsjodFc1V01PKO9Y b6FBIKtN/+/CUQ0F0gT5kjYnN1v3QO4VIQ1kkb/E93JKej0KnNgW3/pD4cGZlWrQtKBr L44SwvPFom6o6//NK5HINLNAIejYlWT7boD48YAuNGArHcm/08AnTuOX7EI5ed+gxfpk NPeyOeb9fVCMqOqC4q7ILTLt/vwq86XO/2vQviL5A8k4sdopvZeI66B7pZvyO5kwcpRI wtsgAnezxqs4ToR/grocIcciupl2Wz5O2+J6zW/nMYhe8bmnYgWxQqzCxeUa3rxXgNcG 3Ueg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Yt5JOwm0NcT9WUAnKZAheixP35Ea1bCMj0wAD05fllA=; b=cDLoX9jXnJJcSVUFbHZ79GASDygAk1zwWddFkRM/xBEBAmKbuoUJsrNb7TczPFGFqL sS8hDS7p1q2FpKr7Xf3eglC/BX+rgbMbCfpp17rh2Ll7HLcEkkTOOCDLMtddUMTpttPM /q8IDiFVjKZSCr8htpRioGCjp4OFN5ki84pnsYHYg0Ypc+RytsEbp7f+54Lsuxn9IS/q mMAVed3wSE61MG1hSCUBk7GnN8JNcCc0oCfrJH5kgRmfRFUuKZTEJ+XrCD7Acv4HgQMj 1mNyJ0tiUp2ptFXmkg/hwq5/NaS2TAm76jLI4dSf4QOle/nGbWd71PrsBoUuy6+HPoQn SMwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=r3oLbdi+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 93si2443297edm.34.2020.11.09.05.06.07; Mon, 09 Nov 2020 05:06:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=r3oLbdi+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730463AbgKINAP (ORCPT + 99 others); Mon, 9 Nov 2020 08:00:15 -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)