From patchwork Thu Oct 17 21:14:12 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: 13840841 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 27228D3C538 for ; Thu, 17 Oct 2024 21:15:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 62B936B0085; Thu, 17 Oct 2024 17:15:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 53ECC6B0088; Thu, 17 Oct 2024 17:15:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3434D6B0089; Thu, 17 Oct 2024 17:15:14 -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 128266B0085 for ; Thu, 17 Oct 2024 17:15:14 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 10E0B1602FA for ; Thu, 17 Oct 2024 21:15:01 +0000 (UTC) X-FDA: 82684349454.05.822035A Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by imf30.hostedemail.com (Postfix) with ESMTP id BE30980013 for ; Thu, 17 Oct 2024 21:14:52 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=aHd1RBwu; spf=pass (imf30.hostedemail.com: domain of andrealmeid@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=andrealmeid@igalia.com; dmarc=pass (policy=none) header.from=igalia.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729199637; a=rsa-sha256; cv=none; b=mTpCi96Ix4GEMvhMH8R1slWJ7P2JDh6DTBZODEaLeNezxuj+xVeE9/Z3SYequLSKqiyeOD uIS3rc3/jHD2h7pok5qksoFxZOjTr+3n5XU7Yzxn4jHJXd8Y+rhlfR0xw4R+fKb47wRhuS Ykej1s3wBZXpfc2tbDS3G2aer1QH/z8= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=aHd1RBwu; spf=pass (imf30.hostedemail.com: domain of andrealmeid@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=andrealmeid@igalia.com; dmarc=pass (policy=none) header.from=igalia.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729199637; 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=sdXGjKgs/rhRe8l19F01/brI44jeC/ablpb8vlTIOo4=; b=LT0wuGHoEva2xfXTRVweZEALpwDAIgwaKYJkj8VNcwhBvmbP5XIrV7wL+XKFE9Agr/OH5P iUJGnbbonDeIWgycI+VXO8qafvowNFtw0xAQ6AYluJ6Ftofu9V4ZZcF7PVEp391h9XSCsi xm3Nu2WJZC7TihZOV/VrhM5nspP6WGY= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: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=sdXGjKgs/rhRe8l19F01/brI44jeC/ablpb8vlTIOo4=; b=aHd1RBwuJnYKAAbtP2Yfezw+8I 2PC4JlmTiVs6vwBZeuda4ovEutYVBnolq0TSsGS0RU614r5mzpMktl4vS4+lKdJpCEgQkHHiWMg7J Na5rV9q16hIJpT1AnU+YWxnFPG1X6RuD6fX0YTPcZpmBLQcm5+Fky1802d/zGITMcm/LQ9WJiJD07 E9vJpYiK73JpidObV8ArRYiwDPPSSoblz71efvX4ktX+tppvh4gWgl8qJHaWBo3wm+4jl1FlGc1rL Pg/EvQhhWC4+cD2jkxeM5wRa5Crnh89AkYqI9UvN1pRj2nWCuZtvUO5SU92fTRGon5Sps8M7owuYo d/zNX3ZA==; Received: from [179.118.186.49] (helo=[192.168.15.100]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1t1Xpa-00Bnlc-1J; Thu, 17 Oct 2024 23:14:50 +0200 From: =?utf-8?q?Andr=C3=A9_Almeida?= Date: Thu, 17 Oct 2024 18:14:12 -0300 Subject: [PATCH v7 2/9] ext4: Use generic_ci_validate_strict_name helper MIME-Version: 1.0 Message-Id: <20241017-tonyk-tmpfs-v7-2-a9c056f8391f@igalia.com> References: <20241017-tonyk-tmpfs-v7-0-a9c056f8391f@igalia.com> In-Reply-To: <20241017-tonyk-tmpfs-v7-0-a9c056f8391f@igalia.com> To: Gabriel Krisman Bertazi , Alexander Viro , Christian Brauner , Jan Kara , Theodore Ts'o , Andreas Dilger , Hugh Dickins , Andrew Morton , Jonathan Corbet , smcv@collabora.com Cc: kernel-dev@igalia.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, Gabriel Krisman Bertazi , =?utf-8?q?Andr=C3=A9_Almeida?= X-Mailer: b4 0.14.2 X-Stat-Signature: k1xir8bika1i3shmp45hcg7zgch4qmfi X-Rspamd-Queue-Id: BE30980013 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1729199692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fN/rLLzJAuQhnd/tVAiNKlyRR7unQ8E5Fk8yrOuro5SQj108hNZCZTPwH3QUP28i9/Sjyb67f1cEiGCrC/K1zRNV1qNz76SWuUg0SNG4/7oMf4/N71mkSBcqVtKMT//9pJjvG/fCaxV4569X5UXyaFx+CD/rj6ZcP1nyd4PdgC4KqchEQD+tY37NKaxDKgui6Xnhh+NdoanIoNIFCYkzEZ8kPfieleZF9TNnQ5CHanYI4wl6kEwHgAPGjekZkBZ4CEdlepb+5GIEf6PkpHLmR4K7DVljg7m80IIHrLat6knM/1avJ0aNbyD6n8ZXDk0dkEMLTqdJ0twICP+3vlHAwa64a9lcMR8F2CZrRssa0oAqAVWUYeBgXmN1uaLncIznAlCaNSs= 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: Use the helper function to check the requirements for casefold directories using strict encoding. Suggested-by: Gabriel Krisman Bertazi Signed-off-by: André Almeida Acked-by: Theodore Ts'o Reviewed-by: Gabriel Krisman Bertazi --- Changes from v4: - Now we can drop the if IS_ENABLED() guard --- fs/ext4/namei.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 790db7eac6c2ad5e1790e363e4ac273162e35013..612ccbeb493b8d901c123221ef6573457193dd16 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -2395,11 +2395,8 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, if (fscrypt_is_nokey_name(dentry)) return -ENOKEY; -#if IS_ENABLED(CONFIG_UNICODE) - if (sb_has_strict_encoding(sb) && IS_CASEFOLDED(dir) && - utf8_validate(sb->s_encoding, &dentry->d_name)) + if (!generic_ci_validate_strict_name(dir, &dentry->d_name)) return -EINVAL; -#endif retval = ext4_fname_setup_filename(dir, &dentry->d_name, 0, &fname); if (retval)