From patchwork Thu Apr 25 04:55:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuezhang.Mo@sony.com" X-Patchwork-Id: 13642872 Received: from mx07-001d1705.pphosted.com (mx07-001d1705.pphosted.com [185.132.183.11]) (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 EB8EF3A1AC for ; Thu, 25 Apr 2024 05:50:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=185.132.183.11 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714024245; cv=fail; b=ImaI9EsBi0hbDhPFmfLeGwLmi94/RE4NilfBjdibTb/vhM+Elm/xBygYlMOLmm5W/ZY0MZE+phcbZOHETSk8WFZKW+sh/L/tcHzPM/cKVEOHur52JKqRBsk5Pcr+AnnBBqGcI2wqtSKtNASTEqpx5T4gz03V6Kqb73STAMNRvKE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714024245; c=relaxed/simple; bh=lD+w+nm/jOnG9Y+hzRhUj13uiHfv4WidGWk/4NGR8PU=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=cdD3PySR8JTJ3lL66iaU68QSpMvWXXIZ8VlUV/nutqCWkRe+95xYvn/u0yLwz9h255ya5+wbxRCNsQw+JbwqGtxZ7jBhStMLQbvErpEfX+zMV5Nfj7vV3XbjnYd6lR/5f7fR122ByTR/Q6ZcKnytH0FxG4cQoXjXuHEMudIX5qA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sony.com; spf=pass smtp.mailfrom=sony.com; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b=PfGwWw47; arc=fail smtp.client-ip=185.132.183.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sony.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sony.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b="PfGwWw47" Received: from pps.filterd (m0209329.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43P4mo36008798; Thu, 25 Apr 2024 04:55:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : to : cc : subject : date : message-id : mime-version : content-type : content-transfer-encoding; s=S1; bh=BPbpxvdPRvrBAr/HKixzehVt/vDLrf6OJ/tT2xB6XfE=; b=PfGwWw47Mf2mzMdPXvAznXhric7s5FF9amN7cSIA6I9nce9giaHyXt96ApsEBmsj/4xg iOzcGvkLtG0Y/LOTmht7HLhTSGOmh40XKumpdD7NdVa2ZgxdF19Q0CqyTgs25B6cyEae 9x1w+5bSbZIvdi7CsmboQ6AM0yWQrB8puAOFN4kNGIaAlEY2GdPg13wzgaJt4ssL3y+5 zGUcZyNGKCPvyU+DlSm8n+jINZjHus+xh15EWsbOQJS18l8KHZL+ipeU9OemKMT9G+X0 +U8Z6urW4dIVNGEaEhEbRIiZ7qt/7EmfPkuWgtoj+Ao6xU8ILzysUjicGvsHxWqC4i88 Yw== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2040.outbound.protection.outlook.com [104.47.110.40]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3xqgf7g07e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Apr 2024 04:55:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PS7nj6dBL/bLecb7oV3CK6nerrUa53dkO9e3ciH9v+eo6vf5kVdlxyqT14AYEplvHP5GWdQsm7plznaXoKXpzFG6+wcpxVLIP2lo3gSvue1snJwSCB8TpxBMiJI8b+d+wyJmmmMp36AgZwQf1/cuRaeP34Y7nJjS0A4XHy9nzPa00ZJjglRNOHClwhhgsYF4c7zBHWAmz5VPpPnk9o/Y+jRQ+2gshoknePizhnP/Kxg4HQuWP27WHrP8hKxtdQRaYxeZecXqfULEpyGFLvpwfJRJI/OY0kOZLdTnR0z5KU7VKfcsIv6M6gKhjV+ia9CzyEM81+epVk3OBxeDxdF+LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BPbpxvdPRvrBAr/HKixzehVt/vDLrf6OJ/tT2xB6XfE=; b=ni9l4/3Mkh+gyp0/IMxPcahNANQ/U/8KLN9vI1Sd6eLO9SP8SD5elGjBY2XqkseAPxw75LgL1SLDh9ewDq3anAiPGcueIG3jbP9ztWU3PS2K5t4gF74+Y0IW7xDhnw4JWq9rlIXO55I6IWsBlHkmTS05Ww52jI9nBv32FyWBSMn98cu/4t4TEHR0zvyQHT3neIWDrs3Wh/RDm4GHLkOkC6IRQ6O5buWPC5OHVRkgDvtfo439wjH3WYBI2rxdFgR7FxGvoF9H/g3UBts5CQEocpvM/tzq6X48X+5r/qvQMSMT5xZDHZFRIV+SxGRTjsCw4RWfnSANAN7KtPwWpFdrIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sony.com; dmarc=pass action=none header.from=sony.com; dkim=pass header.d=sony.com; arc=none Received: from PUZPR04MB6316.apcprd04.prod.outlook.com (2603:1096:301:fc::7) by TYZPR04MB5757.apcprd04.prod.outlook.com (2603:1096:400:1fa::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Thu, 25 Apr 2024 04:55:03 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06%2]) with mapi id 15.20.7472.044; Thu, 25 Apr 2024 04:55:03 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH v2] exfat: zero the reserved fields of file and stream extension dentries Thread-Topic: [PATCH v2] exfat: zero the reserved fields of file and stream extension dentries Thread-Index: AQHalsxZETRKwuiwx0K/rOJfKZ+P5w== Date: Thu, 25 Apr 2024 04:55:03 +0000 Message-ID: Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|TYZPR04MB5757:EE_ x-ms-office365-filtering-correlation-id: 961b3642-0b25-4606-0836-08dc64e3deca x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: =?iso-8859-1?q?B0NhHXjGCx0bhLsonybAEXYcgw?= =?iso-8859-1?q?YF3XOI5Os0t0A9CWmlnWaD8XRl2D2lQkb+sBjFYUbOo/42iPw1NGPPVbXlsz?= =?iso-8859-1?q?FcZVcuQ7/PtCk/vR7yVoYmiDXaKnc4JikjUf0LYTYPAhL5aYgwRYtFHrZqgL?= =?iso-8859-1?q?p12geHe0ugKKrIiAoZ6l1g77GyjqmaKKbYN08kETSpfXpawkgTNE7vFQFjgR?= =?iso-8859-1?q?4ZtnY95TJ07oa4139ekS+ocVmTzkxekZ/LbzC5VQ21oeZEYjBmbj5hz8KJeA?= =?iso-8859-1?q?KTN3nGlCzgJZVPsVZJ/OEnLEf2k6ymEmAX5+86nELdm+vhuakecS1TBG6vDG?= =?iso-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BmCIyTWxxprlIlQaK7zVFRmHQ5zlm3tsPrRyqEF?= =?iso-8859-1?q?48/m3iX+k0PfipkIOmkyOBaU9MY6b4sg5uNKDUYk69bePI8Z/MaF8YGJ/B1O?= =?iso-8859-1?q?ThSf+JGW17eO4uP5UdLv/I2LAGdQenWRntIktjEaIHbioXgBBTfy2f7VHjqO?= =?iso-8859-1?q?zZ2J4A+RqvTYwsz88U/w=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(1800799015)(366007)(38070700009);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?sWzQQJTq8p5daZVFXSyLo0q?= =?iso-8859-1?q?vrNF/LJ0rLS0f5usTnSQhHNJgjowgMoc8Od3OW9gG/x6vhz+V11ze56mBdG8?= =?iso-8859-1?q?H3SSlJRBnzWVZ4jKlt1/iQjfPHMaDz59yrEZsVCGY9gK4P3fA+rKvZ6Z3A8w?= =?iso-8859-1?q?pDbgn7SlJ30TgTyvrAF1Th3uy3TCBPUlFxV6Zxr3UuxvLyQYsQJ67EB5kMaW?= =?iso-8859-1?q?8K9VJPVcw+xvDTNhZIB8+MybjermqbFjVeDAm1dcVIdGA7R3hgTqriQD1yOJ?= =?iso-8859-1?q?wEtgd0N1HKp+39r2DAwriI8Y6sY3UHrH9OtQdbMqgxBnvk//Ow46w6pYg8t4?= =?iso-8859-1?q?ysUuBoSNXUS8DxOi31atXt/kl5QMgpPYsbfldnEumKVCXNaxY1ukzZ95SSTF?= =?iso-8859-1?q?E+NoPLUKjKVDeTbufsjnhdCG22ba7pZRepasHqqREIZzatSm1ZCcmtx81Jl/?= =?iso-8859-1?q?ebCIMHKWXUVZqTyrDBXwkrKaadJc1e9LS7cLGvrjTmwN5pXrcYXJYY+TmOOM?= =?iso-8859-1?q?lAvBrGkLFil5+lNYtz+8sLIK5A7buLktMi+48dk1N8glEcHfyZgmxvGmTBfW?= =?iso-8859-1?q?PUtSOp17IYjnpSTlNYdrIOolJU5N/y8eKmSs8c9uL1dYscmy5lQi9c36VG8L?= =?iso-8859-1?q?qG7bU5lkhpaCgBiaDMboSkvmpwn990wT1IBlwVG7XJPccpVOs4s8ElARRHNP?= =?iso-8859-1?q?+EF3jXBi5AFH0su7xg91D1x2zy2bJ2CfyNOuMwYEZXgunPzDqiwlKiZ5wv+a?= =?iso-8859-1?q?rG4CMvrXUjZu7r1odmqBm3XgKP83etiiTDsY6QFj6AOC7iPmCVTNEE7AJN1D?= =?iso-8859-1?q?hgkdvj9cWwXBtKVmynE/Kzu6YJuu9wwQWdOPYis6KM3+kXOXkpaWkamzioOu?= =?iso-8859-1?q?KDRbpODUmPz7vVYVpzvp4QJ2BnIc49c/3lwTfLk59LlkbFnE98JMMoFrcRy1?= =?iso-8859-1?q?voju762Ku3NOOVXqTEDu4Y5ymSnhtKDwwd11pJxuyBseFBoyauXEeILVoIFg?= =?iso-8859-1?q?r54vSmQbgjmBPHoj26nZIaEqeJGf3vu20uHt4vEaX08ECsMA/cbIDK6G84TD?= =?iso-8859-1?q?j6MF/Ysl9fEA8KbZeDInc1uYWZ/XYUcVZPrzuUwFSJ9tEbiZKnUpitzKPEZU?= =?iso-8859-1?q?GPQM1lcP27glq88awDs6neSSvc80NMY70zSin/fccnt3Z5Bh22BMc0J9aEWe?= =?iso-8859-1?q?VvJ5PAEXNOt9wCkCXlANFMDcjiugg7zQ3yAZwAv/JXN8zKjHPvNUnyu6bO0H?= =?iso-8859-1?q?+54ncKuk/UEuXKf225+snczzJmrtOKCKwmrXFqjTV2qfb2YdhYRqovrBikrv?= =?iso-8859-1?q?eNC3jxMwRL/DlwoqQq/FtMej8osu6zppkTp7dUhWb9a6dxTiR54vMAPPPZCB?= =?iso-8859-1?q?k3/jmQIHzjy4zL9EtPe8CUHFgI7MK7ZzOaC/3CzJqemGdNyyf5Ekih+iQ9xW?= =?iso-8859-1?q?QlUDqruwxXvBnpzRK/5AANwOhI+Y3aWEdsydkxoU0E8yUJH+G4XaH57HQz2f?= =?iso-8859-1?q?n7cc7J4fIKHongurdEmXLJcDe5mzCZd3gHiBDRdat1N8M2YpGtj6J/FRSS1T?= =?iso-8859-1?q?9CiGWxv991rOsLEixI9RstTh8nYrwSqHvsIdGb8deV9hfjE4gX3jviUbZa4v?= =?iso-8859-1?q?UxjqtwlsqSvrvz61pTzukm+fSGQY3fnJ+nI5jv/BvYNKlmUxRBNVSk0mZWz0?= =?iso-8859-1?q?=3D?= Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Y6PR9PARK60AbDc/zAaKVu+p81XMiYLxYpaTAkVyi0nG+v4xGBgvqut+0rzPpv91IAdKNDGRlNbRU7i5eNQePpXspwUI1mQSTPshsw/pZd0+elJj3RKo1KzYp0LkXgpAnQy/na1BnuBLDIETjVw0Z0ZakBLl2W5SI+3Ma/8Pqv90DDByfx528ZC8PhDqV9shm5IrdxGUWjqMpy/YBdTn2ctcROcp60vyElQ7vaPawhxhJXlSDmMpqFyTchszl8ltIYEju77b7MmFM2+uQrPEp4GvcynKudJDt6qfujNIdu4GKJxnrqqcEfcTNS//MQzn92CSqqxyZvgPPGvlrM5GtXf4OLU6+guzP1czji3IAVkaQTTjyZlHcKwq91uuhVReTWs4WgJscHNDg8qi+iO0jHnnkgyRTZCtIqKzjVhOshHyUVTcYotjDVlqF+Q6aofnkE+uyEI4zP+9PJaLbAWs2uV2uD3SkPWs4t44avDoXuSRPYp3eocOEvOHwHRLjPK9C7YxWushQR0DUC2T4Je+YnmJ5gXXi82q4p478nSLnPuZXu9WXewv8QpsgDRx/rVzgcXu4e5e0negMXQvS2ZweLWXi6zoFd+fEG1ZQMwQaYU0/UHVVwFW81DjO9vShvvk X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PUZPR04MB6316.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 961b3642-0b25-4606-0836-08dc64e3deca X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Apr 2024 04:55:03.7889 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: jDgXcdrUAsYzDMWDggpUypuzPzO+wG1E7110KvJylYYK0qGVqk/7aQ1yA0PfraTpFmxQx2KFEYv4tmKdGQZivA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR04MB5757 X-Proofpoint-GUID: T1vSWrSDMqkqz-U-9UUjBLucT8-u16G0 X-Proofpoint-ORIG-GUID: T1vSWrSDMqkqz-U-9UUjBLucT8-u16G0 X-Sony-Outbound-GUID: T1vSWrSDMqkqz-U-9UUjBLucT8-u16G0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-04-25_04,2024-04-24_01,2023-05-22_02 From exFAT specification, the reserved fields should initialize to zero and should not use for any purpose. If create a new dentry set in the UNUSED dentries, all fields had been zeroed when allocating cluster to parent directory. But if create a new dentry set in the DELETED dentries, the reserved fields in file and stream extension dentries may be non-zero. Because only the valid bit of the type field of the dentry is cleared in exfat_remove_entries(), if the type of dentry is different from the original(For example, a dentry that was originally a file name dentry, then set to deleted dentry, and then set as a file dentry), the reserved fields is non-zero. So this commit initializes the dentry to 0 before createing file dentry and stream extension dentry. Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru Reviewed-by: Sungjong Seo --- fs/exfat/dir.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index 077944d3c2c0..84572e11cc05 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -420,6 +420,7 @@ static void exfat_set_entry_type(struct exfat_dentry *ep, unsigned int type) static void exfat_init_stream_entry(struct exfat_dentry *ep, unsigned int start_clu, unsigned long long size) { + memset(ep, 0, sizeof(*ep)); exfat_set_entry_type(ep, TYPE_STREAM); if (size == 0) ep->dentry.stream.flags = ALLOC_FAT_CHAIN; @@ -457,6 +458,7 @@ void exfat_init_dir_entry(struct exfat_entry_set_cache *es, struct exfat_dentry *ep; ep = exfat_get_dentry_cached(es, ES_IDX_FILE); + memset(ep, 0, sizeof(*ep)); exfat_set_entry_type(ep, type); exfat_set_entry_time(sbi, ts, &ep->dentry.file.create_tz,