[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_F692365DD35DD7192C4FB18DEFA5F30DE107@qq.com>
Date: Sun, 3 Nov 2024 12:37:39 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+f51a2a34984e4d8888fd@...kaller.appspotmail.com
Cc: linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [bfs?] general protection fault in bfs_get_block (3)
add a check for new bh
#syz test
diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index fa66a09e496a..10287a1a5846 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -40,6 +40,11 @@ static int bfs_move_block(unsigned long from, unsigned long to,
if (!bh)
return -EIO;
new = sb_getblk(sb, to);
+ if (!new) {
+ bforget(bh);
+ return -ENOMEM;
+ }
+
memcpy(new->b_data, bh->b_data, bh->b_size);
mark_buffer_dirty(new);
bforget(bh);
Powered by blists - more mailing lists