Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp304263lqs; Tue, 5 Mar 2024 02:31:26 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUgwWU12PWrRVTrlrBgxIt9UjHKpDq2keZJZwlcIW3dOOpTkqcPensHhk7aj82QlChTTtutrSvp9j4YAuA9uxq5ERGKF7peE4+esQfLYg== X-Google-Smtp-Source: AGHT+IFOElj/K0OUqjL1w+IsDZ/mqJXoKckeTn1tGYJFDJ8TWg83AJ1Dwkj6e9SOlx2oSvzwkQgO X-Received: by 2002:a37:c241:0:b0:788:2c96:5ac4 with SMTP id j1-20020a37c241000000b007882c965ac4mr1815779qkm.24.1709634686085; Tue, 05 Mar 2024 02:31:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709634686; cv=pass; d=google.com; s=arc-20160816; b=gcP8UzSxD9ojsie7m1uSvy0m5CuGAtxg2Sr9VVNdewMgjgLuxus0AODGIfU1xaq+zD D2ycZFFf4bcIRbDAmTfIis1hfXOnkl6jaNkhpl5gao1mT0hoeU0wkUx3Mhd+eP8GuAj7 W8tPnIrEpioLFWDW8NuHW8p5x1qSq0aq2L7AnIl4PzuYNwdnLRshejN04r8R2/tODgMg y6hVYi6nuOsQL9hOgAmXpFNBRyOQqSFBy2x+6EsZx7ZqQMuyaXZfc8wUwjpl/Fgu4JnX DiOmNos1klCxhuzn9UxHy/VkcB6EZoqR4vC/dGPypRBvjYNHXQFjzJ2y25dZEvcD1s6I OPqQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=8W4xgLXAHu7j23bZ91oYk9DdyruAuK8j58HlBrltQZA=; fh=leNjPu/3B1/amj8pWgnZPg+v2NORBP0eXUn2DeKKAIs=; b=OTe7ieOfQ/xRtVirbMmvtG3z8IWGs93i69fDIHS6WNVGcqtGkq+AyfIUPVxQvEOrk6 KEvc9MTxgrC2Xg4cECiyyze0sQ4hZA2/5l20E1iGJAy378FW4u6EOSY+lUlo+XR3onYz OnUE+CVnF4CMKOxf+u60mPUPEC3lItOBgwVmtPRpQGYt/ncUnnkWWtAEOznQC6EBcQVQ IGljBCbjECpDjttNhjV0NMIuIR/n27Hmhir7cRoZ9RQUHz6slXjzYDd2lSsDhJT1hUTB IaEk9FaY2QEOiGU5fJpDo1V9hTtDikHxwb6x/0Ftx0sJyIXUN1CvLmnC9zuXgMvG0NUQ Vo9g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=oxGh57L9; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-ext4+bounces-1515-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1515-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s8-20020a05620a080800b0078838393b14si435494qks.344.2024.03.05.02.31.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 02:31:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-1515-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=oxGh57L9; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-ext4+bounces-1515-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1515-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com 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 CDC521C21349 for ; Tue, 5 Mar 2024 10:31:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B579E57334; Tue, 5 Mar 2024 10:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="oxGh57L9" X-Original-To: linux-ext4@vger.kernel.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (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 CF33C6EB4B; Tue, 5 Mar 2024 10:16:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709633812; cv=none; b=W2mYhd3ETSyoYXzWbJQKUG6f+5cUhUXOGHirEKm8r2DRK++5OH0D6un/jjpX0yDCYiSqewqUDJzy1AmYuI8TaX1YHEpUiLIeQ0wIf1W9o+bcouggslGXgKSOzg8tAKI4C3ruhlksTOKNMTZFm42AhLrEX4DJRJsX1fBYVi5ERYc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709633812; c=relaxed/simple; bh=VysEZ2lHFHLjYXsEGtqT3tM7vTbrrtv13nJeePZzgiI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rQQESho7y2ZqG4B6rRAcT9uuYjeozCaGEYqHqXN/zt8K9QuodeVdnAc+e6YHtx/1+5AIoo9+8Q2fDiDm/zuGQkig6lJOtZx6QypczogehwtFHlHPxP2G5qvjeLeZdKakTqf++tKDOsVJWGeQebLPlQEB3W89PkWpJ/93KOWtucE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=oxGh57L9; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1709633809; bh=VysEZ2lHFHLjYXsEGtqT3tM7vTbrrtv13nJeePZzgiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oxGh57L9DzbFshNO4gMAW7zI1Vej6TDs0+KddLIM+OhA+vhy2JSRQ+hCNG7c1jpFI QM/SXJTw3Jmf4MSOiGsaBL9niHnZN6xN02d3wutMuNbeMqrapllSM8BjLIqf8/BQC0 It1qJwLq/SbsZSzKpcFDdEvRvjcnXGjDTIVHw2Us9YWoyW/zo1MTsOUd8GgPMGbQXd q66bbmeX+b81CCewGEtRHgJnOA3qY1uZIje/g4VUAqo2XR+1/n0QegedcGNl6DPutL WCrAsqTDaHannc+ADmvLdeX9tsa6RE+ObjNwrFjlFx+lzKncZJ8Qyj/AnIRj5LelUR MaK4y8S+SGx8w== Received: from eugen-station.domain.com (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ehristev) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 9C24C37820E8; Tue, 5 Mar 2024 10:16:46 +0000 (UTC) From: Eugen Hristev To: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, jaegeuk@kernel.org, chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel@collabora.com, eugen.hristev@collabora.com, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, krisman@suse.de Subject: [PATCH v13 7/9] f2fs: Log error when lookup of encoded dentry fails Date: Tue, 5 Mar 2024 12:16:06 +0200 Message-Id: <20240305101608.67943-8-eugen.hristev@collabora.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240305101608.67943-1-eugen.hristev@collabora.com> References: <20240305101608.67943-1-eugen.hristev@collabora.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit If the volume is in strict mode, generi c_ci_compare can report a broken encoding name. This will not trigger on a bad lookup, which is caught earlier, only if the actual disk name is bad. Suggested-by: Gabriel Krisman Bertazi Signed-off-by: Eugen Hristev --- fs/f2fs/dir.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 0601b4c8bacc..1bb98970a56a 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -190,11 +190,22 @@ static inline int f2fs_match_name(const struct inode *dir, struct fscrypt_name f; #if IS_ENABLED(CONFIG_UNICODE) - if (fname->cf_name.name) - return generic_ci_match(dir, fname->usr_fname, - &fname->cf_name, - de_name, de_name_len); - + if (fname->cf_name.name) { + int ret = generic_ci_match(dir, fname->usr_fname, + &fname->cf_name, + de_name, de_name_len); + if (ret < 0) { + /* + * Treat comparison errors as not a match. The + * only case where it happens is on a disk + * corruption or ENOMEM. + */ + if (ret == -EINVAL) + f2fs_warn(F2FS_SB(dir->i_sb), + "Directory contains filename that is invalid UTF-8"); + } + return ret; + } #endif f.usr_fname = fname->usr_fname; f.disk_name = fname->disk_name; -- 2.34.1