From patchwork Thu Oct 10 19:39:37 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: 1995733 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.a=rsa-sha256 header.s=20170329 header.b=DWh5LAbu; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org; envelope-from=srs0=wfno=rg=vger.kernel.org=linux-ext4+bounces-4554-patchwork-incoming=ozlabs.org@ozlabs.org; receiver=patchwork.ozlabs.org) Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XPgCR5LHXz1xv0 for ; Fri, 11 Oct 2024 06:42:59 +1100 (AEDT) Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4XPgCQ6Dhnz4xNw for ; Fri, 11 Oct 2024 06:42:58 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4XPgCQ69Lvz4xP0; Fri, 11 Oct 2024 06:42:58 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; arc=pass smtp.remote-ip="2604:1380:45d1:ec00::1" arc.chain=subspace.kernel.org ARC-Seal: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1728589378; cv=pass; b=vg32cIOzb6W19wuDseCwRN0H55+H86Rgapxdjn6RCmwn5BV70R6jaP4N5W/wvfVsB5ph4vsd0rmfUbgLiVHP7U+DtYnJKb28cMfjrKPWphFHfHRWWXPPXLyddQfPq5SgTi4KfbS39k/s16DXBLMzbLXWuFpCMakc/gQiQtPNG3iLDxgkeyV950gbtp88A2g5VLVr70YdIi9ItIZ7wDie8lS0/i2Uq8NbWrSEXoUMDjaBZkFSzSwkzLLVRSg3DHxCmqh1svvYAQ14W+tbu9P8aMUD9Tt1Fi/9tmhmdHJ3dfDHhaNdaaBwPOp91OfKnLv8BZtLpAv1WLJQrtGLYu5Gzg== ARC-Message-Signature: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1728589378; c=relaxed/relaxed; bh=sdXGjKgs/rhRe8l19F01/brI44jeC/ablpb8vlTIOo4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aM2EOJQcKzzGRZUgm5yem/y939gsWy25uRHg1RCargScCxaM6a4VY2ZATlIPOZ2mQ7Ges6cY6/otu4HjvlCYYQMX2CI+ooPGDcNoQHcf2H44//LjvJmoEdiI/6GTNpE4HVXu5cga0th9IKf165h/2IPRI6juV9xGIV3Q7cAEeA1IXih7CL++9nHkaYZVXaQi2pTmhXSlm2FLwZ+NOqYOnrWzvoGiBatYoR3sN7LPTJjD2CP4AWKnGVaBpInQdfHenwh/yi3INI3PQLNY17hfaDEB8JcLKNRLKCcVjRSr2uuWqOl7BTjHukIsMwNbrZUhKsjsjnIXlrRHfH5wZ30mBQ== ARC-Authentication-Results: i=2; gandalf.ozlabs.org; dmarc=fail (p=none dis=none) header.from=igalia.com; dkim=fail (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.a=rsa-sha256 header.s=20170329 header.b=DWh5LAbu reason="signature verification failed"; dkim-atps=neutral; spf=pass (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-ext4+bounces-4554-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org Authentication-Results: gandalf.ozlabs.org; dmarc=fail (p=none dis=none) header.from=igalia.com Authentication-Results: gandalf.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.a=rsa-sha256 header.s=20170329 header.b=DWh5LAbu; dkim-atps=neutral Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-ext4+bounces-4554-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by gandalf.ozlabs.org (Postfix) with ESMTPS id 4XPgCQ301Jz4xNw for ; Fri, 11 Oct 2024 06:42:58 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 45F8D1C22970 for ; Thu, 10 Oct 2024 19:42:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A14CC1E5726; Thu, 10 Oct 2024 19:41:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="DWh5LAbu" X-Original-To: linux-ext4@vger.kernel.org Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C00F1E379F; Thu, 10 Oct 2024 19:41:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.60.130.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589272; cv=none; b=h9DmgyVP1Tt+gG04RaBzhPU588IxZW/QouBcDOOQ9EwxRhY2jaT7VsfaIsnTI50M4PhNRYk7ohLAaI0KhPQg3FC0kGo/EX3aKj9SbLEPsq8c9f4sprVUvg670yjIyIo868vGEe4bVoVBJG+RA11a1hdYaY9U5HB6PehCqWTJgbc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589272; c=relaxed/simple; bh=3NOu1Q+Yns95EfGtXDCM6tiXYbYx0Sjfavo/kztUt8Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KQuXhgilZnAg5OU7QcBAKWcsvGHNptIASKML4cL+lz0QyN6lwwiGa92y+wtEstyPkDORlJ8zFFNIDGkSFth+DRkkOHHTknS1U32M411Dc/wfPXqNC8Mv9S5DbF2Yq4NSwT6aVxkzOwo2hM5v155XLBPM9o1yh0YSOA0grOTl0ug= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=DWh5LAbu; arc=none smtp.client-ip=178.60.130.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com 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=DWh5LAbuzvrFfI8q3pnduTIg0s RXIu8j3fHbDuSLBLGVQsUPFVBhbhX9XL5iBvP0PfwDrJpJFWYfbEJJVexYEcByIq/md6nNcVKO9VX lsEGXuYGUFtfvKdlEHpZGscyOON7IxJcGXhF17P3W5tmsZwb8RUgSusxruV+oi4LkGgHCkmPPbGO8 toQDAbyZixKMWnkXBYJx5F2P/77DtFxkskUlpuuhpUJ6NN3nDwuPfGlPeasXsW1TNA9yWA2wCscvs KypErmDLlSXacL7q+CPiTmQjQ2JHvTXQVrlp872EyvNHKj14nv+tAAmtcgWIgRvQHzjJaNWBDg/ci 07QFXuew==; Received: from [187.57.199.212] (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 1syz23-007SHz-7a; Thu, 10 Oct 2024 21:41:07 +0200 From: =?utf-8?q?Andr=C3=A9_Almeida?= Date: Thu, 10 Oct 2024 16:39:37 -0300 Subject: [PATCH v6 02/10] ext4: Use generic_ci_validate_strict_name helper Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241010-tonyk-tmpfs-v6-2-79f0ae02e4c8@igalia.com> References: <20241010-tonyk-tmpfs-v6-0-79f0ae02e4c8@igalia.com> In-Reply-To: <20241010-tonyk-tmpfs-v6-0-79f0ae02e4c8@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 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)