From nobody Fri Sep 12 00:29:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE64AC4167B for ; Wed, 6 Dec 2023 15:13:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442480AbjLFPNN (ORCPT ); Wed, 6 Dec 2023 10:13:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379228AbjLFPNL (ORCPT ); Wed, 6 Dec 2023 10:13:11 -0500 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF039DE; Wed, 6 Dec 2023 07:13:17 -0800 (PST) Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 903201E1A; Wed, 6 Dec 2023 15:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1701875211; bh=F097v/jB8ZR21e/O3vd36dCK4gneA3BrFHtMeimQuV4=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=m3/oqph84dOfSvsyEUrnjup2sI052twZlQVgqAS6UOH+jafuQ1FPCmz6Fu7lGEQQi 2/82ZDbxioT09DRo45akAqbUhutD4t5bbxSm44sL5MnKUhvjmAyx/0IIaHypmgn1vm OEh6DBzuauAM8FnZ1RUItM5m01Y3W9cCWxkOJYF0= Received: from [172.16.192.129] (192.168.211.144) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Wed, 6 Dec 2023 18:13:15 +0300 Message-ID: <89861d9e-f3a4-483d-b88d-4085dc2e0a8b@paragon-software.com> Date: Wed, 6 Dec 2023 18:13:15 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 11/16] fs/ntfs3: Drop suid and sgid bits as a part of fpunch Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <00fd1558-fda5-421b-be43-7de69e32cb4e@paragon-software.com> In-Reply-To: <00fd1558-fda5-421b-be43-7de69e32cb4e@paragon-software.com> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.211.144] X-ClientProxiedBy: vobn-exch-01.paragon-software.com (172.30.72.13) To vdlg-exch-02.paragon-software.com (172.30.1.105) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Konstantin Komarov --- =C2=A0fs/ntfs3/file.c | 9 +++++++++ =C2=A01 file changed, 9 insertions(+) diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index bb80ce2eec2f..0ff5d3af2889 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -498,10 +498,14 @@ static long ntfs_fallocate(struct file *file, int=20 mode, loff_t vbo, loff_t len) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ni_lock(ni); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0err =3D attr_punch_hole(ni, vb= o, len, &frame_size); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ni_unlock(ni); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (!err) +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0goto ok; + =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (err !=3D E_NTFS_NOTALIGNED) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0goto out; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0/* Process not aligned punch. = */ +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0err =3D 0; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0mask =3D frame_size - 1; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0vbo_a =3D (vbo + mask) & ~mask; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0end_a =3D end & ~mask; @@ -524,6 +528,8 @@ static long ntfs_fallocate(struct file *file, int=20 mode, loff_t vbo, loff_t len) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ni_lock(ni); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0err =3D att= r_punch_hole(ni, vbo_a, end_a - vbo_a, NULL); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ni_unlock(n= i); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (err) +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0goto out; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0} =C2=A0=C2=A0=C2=A0 =C2=A0} else if (mode & FALLOC_FL_COLLAPSE_RANGE) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0/* @@ -563,6 +569,8 @@ static long ntfs_fallocate(struct file *file, int=20 mode, loff_t vbo, loff_t len) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ni_lock(ni); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0err =3D attr_insert_range(ni, = vbo, len); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ni_unlock(ni); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (err) +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0goto out; =C2=A0=C2=A0=C2=A0 =C2=A0} else { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0/* Check new size. */ =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0u8 cluster_bits =3D sbi->clust= er_bits; @@ -639,6 +647,7 @@ static long ntfs_fallocate(struct file *file, int=20 mode, loff_t vbo, loff_t len) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0} =C2=A0=C2=A0=C2=A0 =C2=A0} +ok: =C2=A0=C2=A0=C2=A0 =C2=A0err =3D file_modified(file); =C2=A0=C2=A0=C2=A0 =C2=A0if (err) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0goto out; --=20 2.34.1