Re: [syzbot] [xfs?] KASAN: null-ptr-deref Write in xfs_filestream_select_ag (2)
From: Edward Adam Davis
Date: Sat Oct 19 2024 - 22:58:27 EST
catch can't pick any perpag
#syz test
diff --git a/fs/xfs/xfs_filestream.c b/fs/xfs/xfs_filestream.c
index e3aaa0555597..8c8f341cf627 100644
--- a/fs/xfs/xfs_filestream.c
+++ b/fs/xfs/xfs_filestream.c
@@ -165,6 +165,7 @@ xfs_filestream_pick_ag(
trace_xfs_filestream_pick(pag, pino, free);
args->pag = pag;
+ printk("pag: %p, %s\n", args->pag, __func__);
return 0;
}
@@ -298,8 +299,8 @@ xfs_filestream_create_association(
*longest = ap->length;
error = xfs_filestream_pick_ag(args, pino, agno, flags, longest);
- if (error)
- return error;
+ if (error || !args->pag)
+ return error ?: 0;
/*
* We are going to use this perag now, so create an assoication for it.