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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_1DD6B365236C297EA3A6A45DB768B76F2605@qq.com>
Date: Sun, 20 Oct 2024 13:30:05 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+4125a3c514e3436a02e6@...kaller.appspotmail.com
Cc: cem@...nel.org,
	chandan.babu@...cle.com,
	djwong@...nel.org,
	linux-kernel@...r.kernel.org,
	linux-xfs@...r.kernel.org,
	syzkaller-bugs@...glegroups.com
Subject: [PATCH] xfs: If unable to pick perag an error needs to be returned

Syzbot reported a null-ptr-deref Write in xfs_filestream_select_ag.
When pag is not found, xfs_filestream_pick_ag() also returns 0, which leads
to null pointer access in xfs_filestream_create_association().

At the end of xfs_filestream_pick_ag, we need to add a sanity check for pag,
if we fail to grab any AG, we should return to -ENOSPC instead of 0.

Reported-and-tested-by: syzbot+4125a3c514e3436a02e6@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=4125a3c514e3436a02e6
Signed-off-by: Edward Adam Davis <eadavis@...com>
---
 fs/xfs/xfs_filestream.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/xfs/xfs_filestream.c b/fs/xfs/xfs_filestream.c
index e3aaa0555597..dd8f193a3957 100644
--- a/fs/xfs/xfs_filestream.c
+++ b/fs/xfs/xfs_filestream.c
@@ -165,6 +165,10 @@ xfs_filestream_pick_ag(
 
 	trace_xfs_filestream_pick(pag, pino, free);
 	args->pag = pag;
+
+	if (!args->pag)
+		return -ENOSPC;
+
 	return 0;
 
 }
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ