From: Saru2003 <sarvesh20123@gmail.com>
To: viro@zeniv.linux.org.uk
Cc: brauner@kernel.org, jack@suse.cz, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, Saru2003 <sarvesh20123@gmail.com>
Subject: [PATCH] Fixed null-ptr-deref Read in drop_buffers
Date: Fri, 8 Nov 2024 08:07:17 +0530 [thread overview]
Message-ID: <20241108023717.8613-1-sarvesh20123@gmail.com> (raw)
Signed-off-by: Saru2003 <sarvesh20123@gmail.com>
---
fs/buffer.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fs/buffer.c b/fs/buffer.c
index 1fc9a50def0b..e32420d8b9e3 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2888,14 +2888,23 @@ 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 failed;
+ }
+
bh = head;
do {
+ if (!bh)
+ goto failed;
if (buffer_busy(bh))
goto failed;
bh = bh->b_this_page;
} while (bh != head);
do {
+ if (!bh)
+ goto failed;
+
struct buffer_head *next = bh->b_this_page;
if (bh->b_assoc_map)
--
2.43.0
next reply other threads:[~2024-11-08 2:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-08 2:37 Saru2003 [this message]
2024-11-08 3:46 ` [PATCH] Fixed null-ptr-deref Read in drop_buffers Al Viro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241108023717.8613-1-sarvesh20123@gmail.com \
--to=sarvesh20123@gmail.com \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox