From patchwork Thu Dec 29 11:52:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sungjong Seo X-Patchwork-Id: 37539 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2660963wrt; Thu, 29 Dec 2022 16:53:42 -0800 (PST) X-Google-Smtp-Source: AMrXdXtccNkBEfK9a1gLbGueHDSpB1i4ZjlOvMWZkZ+CTWay3MwwRLyxVMRZrrpKPZ4pfxwVGN7e X-Received: by 2002:a17:90a:8a13:b0:218:c83e:4733 with SMTP id w19-20020a17090a8a1300b00218c83e4733mr48913311pjn.38.1672361621948; Thu, 29 Dec 2022 16:53:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672361621; cv=none; d=google.com; s=arc-20160816; b=uP49lcEDta/ax6s9Rd2TRVnpiL1rNsIgvWo3GwdVO+rJvhu3A8sEPMEodwa7O4G8zD Up100B2CWerpixCY3wl+yUvtAouk7NbG+UtEXneLqpCvVBYl6YclLor76v3hqWBoJF5I 5SBHBBff0RQRy6vHE/hlWN6f6hLTkrf+BBnycNpb8kVvjf/2m4EGAAQQJcBsiYRE0jdP 4W97jz3mMY2erF9bznL2IdEvH2fLfCPNmA9PzuN6pZbppZUW0HrI9XsZCl5KuvkHK+JE +hlqYvbL6f33yS2bU5lSVgPfFB0qqsRFlDI1xn3mg2MMnMPbGEuQuFkFM1iA4e4WugH2 46wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=+tvtuSUWl1NzTezDXYG0Z6wCNch06t+kT3NNHwqxPys=; b=sSPYYfDZQ2vmitTd60Mc9loW7mZ0G3BYOOYry3pc92Wqxn2Tddc2z5NsXv0ta3Gcg3 GVlHdg8b5awjw6D6e308O0cGHnv/X+ohGlnGEZ7Jv8HOtKcCtdwtIQExwozSx10h3J0R nEH2ZK5IdrOqlD0287yltJRvZnhRLaNVEXr3F/6fYTt3iApBjvjA+CiTJzcmEnA+b1jN eWA8UFKtbUChXBJSa1aQOVf67nhQm8PR50f2EGYxrUuGQjVAVYlPrpGpfNtlWVeS7kZF lJ3bO9Uq3bBttyEXFWT/wgCL8JP4DYbO+uK5HonUsuEZTADC0vzp2apZ3J5/9xNFy9gD PWUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=eJvj8DIs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd10-20020a17090b4cca00b00221621362d7si24120464pjb.17.2022.12.29.16.53.20; Thu, 29 Dec 2022 16:53:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=eJvj8DIs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229865AbiL3AaM (ORCPT + 99 others); Thu, 29 Dec 2022 19:30:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbiL3AaK (ORCPT ); Thu, 29 Dec 2022 19:30:10 -0500 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BE9D178B0 for ; Thu, 29 Dec 2022 16:30:05 -0800 (PST) Received: from epcas3p3.samsung.com (unknown [182.195.41.21]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20221230003002epoutp03b5e63262a419e04b58ad67280a0efde3~1ar5WK8TB0532905329epoutp03l for ; Fri, 30 Dec 2022 00:30:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20221230003002epoutp03b5e63262a419e04b58ad67280a0efde3~1ar5WK8TB0532905329epoutp03l DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1672360202; bh=+tvtuSUWl1NzTezDXYG0Z6wCNch06t+kT3NNHwqxPys=; h=From:To:Cc:Subject:Date:References:From; b=eJvj8DIsPPnWe3zhKQUjnYns6IJFiIkKZOSOFBQkXEcG3Usp6CbLPGGPVLaj5J9RB J1pI/ELmkEHaKV5DXmVvBtOKJnXCvH5dHOBa/+YCuJxBihImorwaoXpJ4TNF6QOheM EVgBi/HxDvqeK8u27ZYSig2knM1EG5rK/lvqXBz4= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas3p3.samsung.com (KnoxPortal) with ESMTP id 20221230003001epcas3p3363d51c49cbbc6de4379d25b9622fbce~1ar46CLWH1067710677epcas3p3B; Fri, 30 Dec 2022 00:30:01 +0000 (GMT) Received: from epcpadp3 (unknown [182.195.40.17]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4NjmP55KHRz4x9Q0; Fri, 30 Dec 2022 00:30:01 +0000 (GMT) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p2.samsung.com (KnoxPortal) with ESMTPA id 20221229115257epcas1p27195844dc54cf09608dad9967808530a~1QW4L37ph2094120941epcas1p2w; Thu, 29 Dec 2022 11:52:57 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20221229115257epsmtrp1d43ffca1fd9e78952882933bda8838ba~1QW4LKav82629826298epsmtrp14; Thu, 29 Dec 2022 11:52:57 +0000 (GMT) X-AuditID: b6c32a29-f05bc700000008a3-dc-63ad7f99bacb Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 7B.74.02211.99F7DA36; Thu, 29 Dec 2022 20:52:57 +0900 (KST) Received: from u20pb1-0435.tn.corp.samsungelectronics.net (unknown [10.91.133.14]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20221229115257epsmtip183731033688138e7f4e545a6111df90b~1QW373ajx1835018350epsmtip1K; Thu, 29 Dec 2022 11:52:57 +0000 (GMT) From: Sungjong Seo To: linkinjeon@kernel.org Cc: pali@kernel.org, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Sungjong Seo , Yuezhang Mo Subject: [PATCH] exfat: redefine DIR_DELETED as the bad cluster number Date: Thu, 29 Dec 2022 20:52:38 +0900 Message-Id: <1891546521.01672360201726.JavaMail.epsvc@epcpadp3> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHLMWRmVeSWpSXmKPExsWy7bCSnO7M+rXJBreXSli8PKRpMXHaUmaL PXtPslhc3jWHzWLBntNsFlv+HWG1OP/3OKvF9TcPWR04PDat6mTz6NuyitGjfcJOZo/Pm+Q8 Nj15yxTAGsVlk5Kak1mWWqRvl8CVMWn/YaaCFs6Kf+cXMzUwHmLvYuTgkBAwkXh/wLeLkYtD SGA3o8SJ3o2MEHEpiYP7NCFMYYnDh4u7GDmBSlqZJB5MLwCx2QS0JZY3LWMGKRERkJRYez8V ZAqzwD5GiU3LnjOD1AgLuEnMuvuECaSGRUBVYtGxSJAwr4CtxJOm/4wgtoSAvMTMS9/ZIeKC EidnPmEBsZmB4s1bZzNPYOSbhSQ1C0lqASPTKkbJ1ILi3PTcYsMCw7zUcr3ixNzi0rx0veT8 3E2M4CDV0tzBuH3VB71DjEwcjIcYJTiYlUR4Nc6uThbiTUmsrEotyo8vKs1JLT7EKM3BoiTO e6HrZLyQQHpiSWp2ampBahFMlomDU6qBKTPAIZ9zadvEFc3b6wIPzvWXrH7pckJGIo+JdUfC 87taIk4HHVkO393BN+nrA5M7nvodK2Yzm2yJyZ+duXZFtebm3f7rr01rY0qze7fkUe8fYd0b PIbzjLWcPRdaBX6e0nrEKWHXS2XJ53o5MvYySdNKt72IOTXDTGKh5ZfUyAf8NVdLDxrqbVv4 VYuR2XW+7OxklrKF2oU8cQprV3JdVut5t+KZ8OHO9Q+5RPJLI3zvKVdnpigYOBVYaq+6WCCv z/d/09GEpKXrvddoHbD8Gp9eOM/llnPH7eZPvMWnZ27mnKYSzsj8wcn0idKKU+6up4+sUOze MUEo7t7m2Isc/zSOyyyzUrOcNlUofMomJZbijERDLeai4kQA4hbc98ECAAA= X-CMS-MailID: 20221229115257epcas1p27195844dc54cf09608dad9967808530a X-Msg-Generator: CA X-Sendblock-Type: SVC_REQ_APPROVE X-CPGSPASS: Y X-ArchiveUser: EV X-Hop-Count: 3 X-CMS-RootMailID: 20221229115257epcas1p27195844dc54cf09608dad9967808530a References: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753598259632130790?= X-GMAIL-MSGID: =?utf-8?q?1753598259632130790?= When a file or a directory is deleted, the hint for the cluster of its parent directory in its in-memory inode is set as DIR_DELETED. Therefore, DIR_DELETED must be one of invalid cluster numbers. According to the exFAT specification, a volume can have at most 2^32-11 clusters. However, DIR_DELETED is wrongly defined as 0xFFFF0321, which could be a valid cluster number. To fix it, let's redefine DIR_DELETED as 0xFFFFFFF7, the bad cluster number. Fixes: 1acf1a564b60 ("exfat: add in-memory and on-disk structures and headers") Reported-by: Yuezhang Mo Signed-off-by: Sungjong Seo --- fs/exfat/exfat_fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index bc6d21d7c5ad..25a5df0fdfe0 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -50,7 +50,7 @@ enum { #define ES_IDX_LAST_FILENAME(name_len) \ (ES_IDX_FIRST_FILENAME + EXFAT_FILENAME_ENTRY_NUM(name_len) - 1) -#define DIR_DELETED 0xFFFF0321 +#define DIR_DELETED 0xFFFFFFF7 /* type values */ #define TYPE_UNUSED 0x0000