From patchwork Wed Sep 11 14:44:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 13800721 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A75AEE49BD for ; Wed, 11 Sep 2024 14:45:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 82A0F940055; Wed, 11 Sep 2024 10:45:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D8D8940053; Wed, 11 Sep 2024 10:45:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 67A20940055; Wed, 11 Sep 2024 10:45:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 4B409940053 for ; Wed, 11 Sep 2024 10:45:42 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id F2B2C141545 for ; Wed, 11 Sep 2024 14:45:41 +0000 (UTC) X-FDA: 82552731282.24.25A0E08 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by imf18.hostedemail.com (Postfix) with ESMTP id 306731C000C for ; Wed, 11 Sep 2024 14:45:39 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=JM3ErL2m; dmarc=pass (policy=none) header.from=igalia.com; spf=pass (imf18.hostedemail.com: domain of andrealmeid@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=andrealmeid@igalia.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726065855; a=rsa-sha256; cv=none; b=gJVMx2wHqdWX/ajcYXarvYhpQXa+hwBicAMX21b5kNwAnQhy6f+W5/1Gy5hdT6gfN0wZ9J 7e4EkQdFXsx+N/K169ahYTlOMAGwvkXMZ6S5zJY1n/YMVjUkGP/SNsqLbTw0sViGHz5Anq Z1m6OKRfPGh1imZhuqwhOd+l2jfTpAU= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=JM3ErL2m; dmarc=pass (policy=none) header.from=igalia.com; spf=pass (imf18.hostedemail.com: domain of andrealmeid@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=andrealmeid@igalia.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1726065855; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3FFQIAuGvH/0A1mPCgj4xlU1M+Y3nXSW60dESGxKvsQ=; b=B6LpWd5S8ziLMyFyAN6RMN9RwaxQdN36um2BO26O+NTMXfrsCG7tksuRSl1hZJ6LhRnp8P OeJkmtpFXDSfelgiwEheWvwxPsmx4CBtpXI7oYmcLuoNxQ6kHn47LMeJvcU/Pc4WJ1Yz/v E5bBL1idmKBCnrJ3RXyMnAAU+7qig1M= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=3FFQIAuGvH/0A1mPCgj4xlU1M+Y3nXSW60dESGxKvsQ=; b=JM3ErL2mdbpqkr+KcUJ1aszMzB jLUIm09KwRkExt16iFaCVWUoYp+LQYa1M8VbtDybGticsjAqAlWcY2NjwguRMr8P3SiiqOT+fbESB 3KQTsCcWkDhdfP0wvYJ9Vge/dkxu7H24NfFYEYPIZmMHqhv7hW80CTFZQ94DizqdnAvx9ruoU02MG tAc2qt6fQ24oNqy7UUU6FxcXymXkkPUVxqlCjU9lrA6CjR+R7J546lGLArpOb7MISi5m+tQyBPemd +KDsSJsXEv+xrk2OD2lZ2WZpAziErf0cxqXrKqtZLXWYgrIq8V+vCRArNAZnX0WkvFBZKEqQJk5Ih m6IL6OTw==; Received: from [177.172.122.98] (helo=localhost.localdomain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1soOb6-00CTwi-Pc; Wed, 11 Sep 2024 16:45:33 +0200 From: =?utf-8?q?Andr=C3=A9_Almeida?= To: Hugh Dickins , Andrew Morton , Alexander Viro , Christian Brauner , Jan Kara , krisman@kernel.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, kernel-dev@igalia.com, Daniel Rosenberg , smcv@collabora.com, Christoph Hellwig , Theodore Ts'o , =?utf-8?q?An?= =?utf-8?q?dr=C3=A9_Almeida?= Subject: [PATCH v4 05/10] libfs: Check for casefold dirs on simple_lookup() Date: Wed, 11 Sep 2024 11:44:57 -0300 Message-ID: <20240911144502.115260-6-andrealmeid@igalia.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240911144502.115260-1-andrealmeid@igalia.com> References: <20240911144502.115260-1-andrealmeid@igalia.com> MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 306731C000C X-Stat-Signature: 5unyd95t76jq1pu1fk951q3dgfazonkm X-Rspam-User: X-HE-Tag: 1726065939-351 X-HE-Meta: U2FsdGVkX18ReA7smVEcxyQgG7PECbNI/0cB4jbxoc4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qnNkEBVfBQc1uHT57MmSPadZCpp9BMvdWH2BjMs2gkrsyRRskUTAMjxDCvqPslxFOA4LP3oQ46FRsl07rQDsEyMBdlIITAJWVESIO0E/HWR+KIq+WOTeD6q66ysZuUD5SJQyh24Dx1ZWqTmN63t/sANF8c8siOgeQZOaOkk3hepxC3SglipaXuKoc2kwtzEjZtg1NCm0UZ9SDxiplKwFMhks2uvyreRWKv7+pL50cJEe2KSngoU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On simple_lookup(), do not create dentries for casefold directories. Currently, VFS does not support case-insensitive negative dentries and can create inconsistencies in the filesystem. Prevent such dentries to being created in the first place. Signed-off-by: André Almeida --- fs/libfs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/libfs.c b/fs/libfs.c index 99fb36b48708..838524314b1b 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -77,6 +77,10 @@ struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, unsigned return ERR_PTR(-ENAMETOOLONG); if (!dentry->d_sb->s_d_op) d_set_d_op(dentry, &simple_dentry_operations); + + if (IS_ENABLED(CONFIG_UNICODE) && IS_CASEFOLDED(dir)) + return NULL; + d_add(dentry, NULL); return NULL; }