From patchwork Tue Apr 23 02:28:40 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: 13639270 Received: from mx08-001d1705.pphosted.com (mx08-001d1705.pphosted.com [185.183.30.70]) (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 D28B418032 for ; Tue, 23 Apr 2024 03:21:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=185.183.30.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713842502; cv=fail; b=nflTQdDBQiP4t9o7Gagv4nyIiuN3B12hdcMtzdfmBG+NpF8OJmYwNcpjMHneO66lu9mKVN0UpiEFrsW/cVM8tmTXXU97fyqYCRTqh1JPXjPZZuaYW7nV5YRRbMI5ZCVccQlPj2XHDVyBtGDBUXT451+/bitQZ5G+veiJbM1VLvs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713842502; c=relaxed/simple; bh=8ssvk9RmfOtqbliVFTCCLHyGSV5bVHvc7dtGVQHNtXo=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=mn8OJvjz1Max1MJ1shAMEwmtrCqN06iEA5worMsONzQS8UusX2cmbw4/Xo3gU+xyjGqJ2Ux3yXySjjMNtLUIHjIlCGyIkiD+IQEMaHFcMD9IXk0XtaxBp0MUo7Isfo+G/NOQxm+ZqsMw9TL7DcmrN/EcU5hENdLmpR7qL8eziok= 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=Ui7d7zYJ; arc=fail smtp.client-ip=185.183.30.70 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="Ui7d7zYJ" Received: from pps.filterd (m0209323.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43N29ILc032613; Tue, 23 Apr 2024 02:28:50 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; s=S1; bh=dHarffTyXCPEunQhmR88YDVsATcnpVaBh1Kgys9sDMM=; b=Ui7d7zYJ87BBYhmAH3KdvuhWADSFqrFdmbHuGN/EL27fZnuVfmaBKziYtExp3FXD2825 I6WL4V8bxTrcGH/7pHfpqib9mCiBy6+H5weRI9Zwi8bcYkpxNrN7OKo3yowCUNy31n8x zfEs+TlIydaJiQXE+8RsgeCDD0/BS2QViH79RduQgrLofEamUZQio6T0sgyXliAzark6 3BMDcjsMeRMYmJTbCuQRZJFu8a6R6wDuXzI0TJsieDDjQmA4kK9sxVF+982+L9FJQvtJ q40px2cAe2UjsF3reKIAr4qYmkhnOmoXuu4vqhpVPGe5Dq4iyHRo9P/TQSe5Vmo0/x9B mA== Received: from apc01-sg2-obe.outbound.protection.outlook.com (mail-sgaapc01lp2105.outbound.protection.outlook.com [104.47.26.105]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3xm521jhkx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Apr 2024 02:28:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KmX76cz2jTV8/cLdjAbcPBsAquY5W6jL9ynRH+MhpTWp6Ju9cyDUOAWHVQ0EQGulRa/V5hwa7Po9gJgX8egcqt5ySo8DORggyz2D0A1249rVM2x/v5OXvaWvoGLJ8DXqEMPe8vGLksH974XMJzc1Eizrhmn6Qg5LchE5RD0Sv/xmSL9Mus3SCwXhcFYNEZqrqombYkLn5uWvM0JJSqXMjSbpA5Un36Psv9cqn5ecHlfZI7wdEAy6nrutnpsQL6e8KuTG+sf2TE58aFLopAEvUMwBUKIUy+bK9Ty73SuExqfjLDMBdsBPTIHJEsWy7D2HseNgPdstSQL6Cvgbkzn0RQ== 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=dHarffTyXCPEunQhmR88YDVsATcnpVaBh1Kgys9sDMM=; b=dE0YK65bPVhzPn2OBnp3qTCwZyjvlQ/VL7z8outiyc3jj2ohOu4ovBkGd0sdoFr9J3vd34JdlihUceBA5QfL9Y0Xhkh9AoiYoLGOMLq2vGNt1WX4xDSH0ZLw/QFexaOfNsiA9LV8hx498OsFVq3ksXWwQQqL4H2NcxKlRqWGmUP8ibsbpiiz4fvYR9XxDJ2N3+JItLbhxsiG39nLqJCPOr03Y7CKpdog/3LHA0zK/dplcSijkK9aJz1iJUESZ4/OsT1/4ww8ai/Ga82q8HaaQ9tiK6zYA21tk6RRc8xim5ok49q/UAC8rpB3AvZgxFGlS4PxyyC8/GNF9uO20s9S6A== 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 KL1PR04MB7106.apcprd04.prod.outlook.com (2603:1096:820:fa::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Tue, 23 Apr 2024 02:28:40 +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; Tue, 23 Apr 2024 02:28:40 +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 v1] exfat: zero the reserved fields of file and stream extension dentries Thread-Topic: [PATCH v1] exfat: zero the reserved fields of file and stream extension dentries Thread-Index: AQHalSVihLmFn4H720eTr8GfTnzOoA== Date: Tue, 23 Apr 2024 02:28:40 +0000 Message-ID: Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|KL1PR04MB7106:EE_ x-ms-office365-filtering-correlation-id: 68d0fc46-7dc0-44dc-003a-08dc633d16c0 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?XLcQ9gvJgk93QcxXG8jtx9I8q9?= =?iso-8859-1?q?ULwS1VTiSVPLp/tQyx3pkuK8OiDWVs6JWu4zrj6zmwln+1xCRR+hZdCTKcpE?= =?iso-8859-1?q?L0x9YyD8mW5BfwkBEIKOwvZmaGsaKT6C8Fg8vqqPVeIzPt+/59f7Urx2hrjr?= =?iso-8859-1?q?l3egDP4pd9JBdrVuHm/xS7foU8rAc3EJz86rNyRRv0ZyflBUHwgaD4c0wexx?= =?iso-8859-1?q?vON03ctDiF7nDF5BGkIdfFRcqE2Er3Ss58t6/nCOniTds4J/uIMeRL1kCRH8?= =?iso-8859-1?q?xVeXpMks+RXXJroGjYgW4AvZz6mw0oYNDve7pv8nMFNifvwWsSbi1hGZNRML?= =?iso-8859-1?q?PGjFzE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1opfV9wLTxGVT6tn2vfqlKiXOeGtI?= =?iso-8859-1?q?023DaEddyAGCIZ8EgrObYvRCIWQ2LUWMhMfpmbVcQjnyDeQrXsVB6raTehb8?= =?iso-8859-1?q?2QOpqwsuI8g81vN9kYGnZjTc3wdbVK9DMkzbDpXt3yrXTMWLiQja7hbKE9Oy?= =?iso-8859-1?q?WI/KjK5RWqGW5UwlwLnw=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)(366007)(1800799015)(376005)(38070700009);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?5jNpDMb0SKhck05LjPBxxjN?= =?iso-8859-1?q?sYcnp3q2tAoyoCdPNVkCV+23j28jEWpksgFtMd/NyQARI1NcKWXh+xPXP9bD?= =?iso-8859-1?q?v20eVUg/r898drgoM2bHzLI+61dvx/C/ESWo/GpXXwd5bn7WIEFpjjVwuMLr?= =?iso-8859-1?q?3ll3RK64jxInuAGzC8MIlmMkLfFM6kKb2M0cw5+vqhi1B2BFOCMSbntu1qyR?= =?iso-8859-1?q?0SMw2vNHTgm89IIpPFuSg9KrmtmB6Usf2eB3N80bXUlnj2Ft+rNB+EaNJFJt?= =?iso-8859-1?q?GNdvY+KECN2eh8O58UpT5CLi8nINLiRH6pqMaK+XmrtNnOjojWw/EvTSnxi+?= =?iso-8859-1?q?UykAG1eSO8EJcCPod1lVmkWc0Er2f8SqNv9oh1CguzPgW9I1QV4TQLQeGATp?= =?iso-8859-1?q?GrhWe+qcO7neFZUH1QustavGHxRGRc0mn236spf94lWpG8cXFuOsCv+z4IcS?= =?iso-8859-1?q?/IveYAI9ZHDQbJEfKiKlmiQ52k4JeojVtQI8wpO3gqlbKrB7mmJUuOgFR1iM?= =?iso-8859-1?q?N9k8Ko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dbsXwnvoOYd6I+Tnub4W5Q?= =?iso-8859-1?q?NwdSiRLbBoowC+Pz5b/zfrIvAntt6E5ENPilXF6SwbFxg+0SI9HYVZG0VjaI?= =?iso-8859-1?q?njruKjC1pNEU4Jj3OnIovWIk7zeKNsd8K5AZY7VrNOe3270YywTqkuYjGa+s?= =?iso-8859-1?q?9DYERRiglHktf/NZAZH7QguoG1fUrlECDhsNALJSLNu4XBnXUP1/uAZKIMK7?= =?iso-8859-1?q?0Lzn179wbmj7Yzka1jaNKK26CyxLzNuXScFuv1zYqmXGt0MCIpAaa6/uhClE?= =?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: q0VAuagEryTap9/BSmVdRuHTQ22t8MXtilLMHRwbOrzXcg5CHI5/Th4GixcLJj7jrrknNavFBlIKWHoxjlO0c7Qfay8uVtriC6R/WXcnRPUXft8oi/MOGZWfJMah6m/9D6kFp6FKBsTrhKY4NwyKwG3FJZZAWgg8AYVVLO8VBgUadVmG3zZFGHRLTZhqGLAJ4TPAH7YLyDLRQTTIgTxd6uzY4ATYubXex8oqyUheivRfopsGS4f7RTbIXdIU9rZ/LFRT5nYP6bD5eEWKsGEFKXL9e1wIg4ZFEN8WQDi0gdy8tuCQGTkg6N00PiTxPSXtugRSMDvJ3hWHgBcqbcPo/XJdRTCIBK4yDx1I9zYqoKBvIDXLLI3ureZ8KhFvPiOgZgyxnS52+0OQMSmJ3MSWXmkwjcivgvL0iyq+enTFw3nwf823evjfHTTI1zdzlQ6l862ULWEykdNtl8R8b1A4LJLpstGQ1+1Y74MPmpyadJk2+fk5l/c9asmpM/xVotYc84lEfQH6l4p5T5PqCr9C/kzh3etp2zqqcdwxneBICUwRWrdRe9oHqUyNpziPI7bkzZZGDd4l+ZGuHYPS22uRXDypV6g96ci2LO+fW+7875gg8bow1zOqgN8gAeXiJYI7 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: 68d0fc46-7dc0-44dc-003a-08dc633d16c0 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Apr 2024 02:28:40.4977 (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: eO1xDMhWMPDBkvNjb1Dchri5tF/YU4gnJCPdEd0+Epoo381le/ePIKbsx6zzGwNN1LiG4dhdl4ovoiklu9ORhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR04MB7106 X-Proofpoint-GUID: YmiWecWgK4fDuK44TfLDoJNCTphg9M2F X-Proofpoint-ORIG-GUID: YmiWecWgK4fDuK44TfLDoJNCTphg9M2F X-Sony-Outbound-GUID: YmiWecWgK4fDuK44TfLDoJNCTphg9M2F X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-23_02,2024-04-22_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 zeroes the reserved fields when createing file dentry and stream extension dentry. Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru --- fs/exfat/dir.c | 7 +++++++ 1 file changed, 7 insertions(+) From a44117862361870f994029f8a8424905fe3cc0f0 Mon Sep 17 00:00:00 2001 From: Yuezhang Mo Date: Fri, 12 Jan 2024 14:48:46 +0800 Subject: [PATCH v1] exfat: zero the reserved fields of file and stream extension dentries 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 zeroes the reserved fields when createing file dentry and stream extension dentry. Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru --- fs/exfat/dir.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index 077944d3c2c0..cbdd9b59053d 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -428,6 +428,10 @@ static void exfat_init_stream_entry(struct exfat_dentry *ep, ep->dentry.stream.start_clu = cpu_to_le32(start_clu); ep->dentry.stream.valid_size = cpu_to_le64(size); ep->dentry.stream.size = cpu_to_le64(size); + + ep->dentry.stream.reserved1 = 0; + ep->dentry.stream.reserved2 = 0; + ep->dentry.stream.reserved3 = 0; } static void exfat_init_name_entry(struct exfat_dentry *ep, @@ -474,6 +478,9 @@ void exfat_init_dir_entry(struct exfat_entry_set_cache *es, &ep->dentry.file.access_date, NULL); + ep->dentry.file.reserved1 = 0; + memset(ep->dentry.file.reserved2, 0, sizeof(ep->dentry.file.reserved2)); + ep = exfat_get_dentry_cached(es, ES_IDX_STREAM); exfat_init_stream_entry(ep, start_clu, size); } -- 2.34.1