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>] [day] [month] [year] [list]
Message-ID: <20250523092931.16976-1-yechey@ai-sast.com>
Date: Fri, 23 May 2025 17:29:31 +0800
From: Ye Chey <yechey@...sast.com>
To: cem@...nel.org
Cc: linux-xfs@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Ye Chey <yechey@...sast.com>
Subject: [PATCH] xfs: fix potential NULL pointer dereference in zone GC

Under memory pressure, bio_alloc_bioset() may fail and return NULL,
which could lead to a NULL pointer dereference in the zone GC code.
Add proper error handling to prevent this scenario by checking the
return value and cleaning up resources appropriately.

Signed-off-by: Ye Chey <yechey@...sast.com>
---
 fs/xfs/xfs_zone_gc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/xfs/xfs_zone_gc.c b/fs/xfs/xfs_zone_gc.c
index d613a4094..ec87b5d6b 100644
--- a/fs/xfs/xfs_zone_gc.c
+++ b/fs/xfs/xfs_zone_gc.c
@@ -697,6 +697,11 @@ xfs_zone_gc_start_chunk(
 	}
 
 	bio = bio_alloc_bioset(bdev, 1, REQ_OP_READ, GFP_NOFS, &data->bio_set);
+	if (!bio) {
+		xfs_irele(ip);
+		xfs_open_zone_put(oz);
+		return false;
+	}
 
 	chunk = container_of(bio, struct xfs_gc_bio, bio);
 	chunk->ip = ip;
-- 
2.44.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ