[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <68ccb104.050a0220.28a605.0014.GAE@google.com>
Date: Thu, 18 Sep 2025 18:25:24 -0700
From: syzbot <syzbot+fd3f70a4509fca8c265d@...kaller.appspotmail.com>
To: linux-kernel@...r.kernel.org
Subject: Forwarded: Re: [syzbot] WARNING in ext4_mb_load_buddy_gfp
For archival purposes, forwarding an incoming command email to
linux-kernel@...r.kernel.org.
***
Subject: Re: [syzbot] WARNING in ext4_mb_load_buddy_gfp
Author: kartikey406@...il.com
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
master
>From 24ea14fccda1e40b265a9f79b865958e215b240c Mon Sep 17 00:00:00 2001
From: Deepanshu Kartikey <kartikey406@...il.com>
Date: Fri, 19 Sep 2025 06:49:46 +0530
Subject: [PATCH] ext4: fix allocation failure in
ext4_mb_load_buddy_gfp
Fix WARNING in __alloc_pages_slowpath() when ext4_discard_preallocations()
is called during memory pressure.
The issue occurs when __GFP_NOFAIL is used during memory reclaim context,
which can lead to allocation warnings. Avoid using __GFP_NOFAIL when
the current process is already in memory allocation context to prevent
potential deadlocks and warnings.
Reported-by: syzbot+fd3f70a4509fca8c265d@...kaller.appspotmail.com
Signed-off-by: Deepanshu Kartikey <kartikey406@...il.com>
---
fs/ext4/mballoc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 5898d92ba19f..61ee009717f1 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -5656,9 +5656,11 @@ void ext4_discard_preallocations(struct inode *inode)
list_for_each_entry_safe(pa, tmp, &list, u.pa_tmp_list) {
BUG_ON(pa->pa_type != MB_INODE_PA);
group = ext4_get_group_number(sb, pa->pa_pstart);
+ gfp_t flags = GFP_NOFS;
+ if (!(current->flags & PF_MEMALLOC))
+ flags |= __GFP_NOFAIL;
- err = ext4_mb_load_buddy_gfp(sb, group, &e4b,
- GFP_NOFS|__GFP_NOFAIL);
+ err = ext4_mb_load_buddy_gfp(sb, group, &e4b, flags);
if (err) {
ext4_error_err(sb, -err, "Error %d loading buddy information for %u",
err, group);
--
2.43.0
Powered by blists - more mailing lists