Re: [syzbot] [PATCH] Re: [syzbot] [jfs?] KASAN: null-ptr-deref Read in drop_buffers (3)

syzbot
2025-04-22T19:22:41Z

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [PATCH] Re: [syzbot] [jfs?] KASAN: null-ptr-deref Read in drop_buffers (3)
Author: richard120310@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git cb82ca153949

Signed-off-by: I Hsin Cheng <richard120310@gmail.com>
---
fs/buffer.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/fs/buffer.c b/fs/buffer.c
index cc8452f60251..e65a754176c1 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2883,6 +2883,8 @@ drop_buffers(struct folio *folio, struct buffer_head **buffers_to_free)
struct buffer_head *head = folio_buffers(folio);
struct buffer_head *bh;

+ if (!head)
+ goto out;
bh = head;
do {
if (buffer_busy(bh))
@@ -2897,6 +2899,7 @@ drop_buffers(struct folio *folio, struct buffer_head **buffers_to_free)
__remove_assoc_queue(bh);
bh = next;
} while (bh != head);
+out:
*buffers_to_free = head;
folio_detach_private(folio);
return true;
--
2.43.0