lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241026180116.10536-1-alexjlzheng@tencent.com>
Date: Sun, 27 Oct 2024 02:01:16 +0800
From: alexjlzheng@...il.com
To: cem@...nel.org,
	djwong@...nel.org
Cc: chandanbabu@...nel.org,
	dchinner@...hat.com,
	zhangjiachen.jaycee@...edance.com,
	linux-xfs@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Jinliang Zheng <alexjlzheng@...cent.com>
Subject: [PATCH] xfs: fix the judgment of whether the file already has extents

From: Jinliang Zheng <alexjlzheng@...cent.com>

When we call create(), lseek() and write() sequentially, offset != 0
cannot be used as a judgment condition for whether the file already
has extents.

This patch uses prev.br_startoff instead of offset != 0.

Signed-off-by: Jinliang Zheng <alexjlzheng@...cent.com>
---
 fs/xfs/libxfs/xfs_bmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 36dd08d13293..94e7aeed9e95 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -3536,7 +3536,7 @@ xfs_bmap_btalloc_at_eof(
 	 * or it's the first allocation in a file, just try for a stripe aligned
 	 * allocation.
 	 */
-	if (ap->offset) {
+	if (ap->prev.br_startoff != NULLFILEOFF) {
 		xfs_extlen_t	nextminlen = 0;
 
 		/*
-- 
2.41.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ