From: Jeremy Cline <jeremy@jcline.org>
To: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Jeremy Cline <jeremy@jcline.org>,
syzbot+5ce571007a695806e949@syzkaller.appspotmail.com
Subject: [PATCH] hfs: check return value before accessing fd in hfs_brec_find()
Date: Fri, 3 Nov 2023 09:03:59 -0400 [thread overview]
Message-ID: <20231103130359.882002-1-jeremy@jcline.org> (raw)
In the event that hfs_brec_keylen() fails, an error is returned to the
caller of __hfs_brec_find() and the struct hfs_find_data is not
initialized.
The result needs to be checked before attempting to read any fields from
fd.
Reported-by: syzbot+5ce571007a695806e949@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=5ce571007a695806e949
Signed-off-by: Jeremy Cline <jeremy@jcline.org>
---
fs/hfs/bfind.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c
index ef9498a6e88a..f225c78a9e66 100644
--- a/fs/hfs/bfind.c
+++ b/fs/hfs/bfind.c
@@ -136,6 +136,8 @@ int hfs_brec_find(struct hfs_find_data *fd)
bnode->parent = parent;
res = __hfs_brec_find(bnode, fd);
+ if (res < 0)
+ goto release;
if (!height)
break;
if (fd->record < 0)
--
2.41.0
reply other threads:[~2023-11-03 13:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20231103130359.882002-1-jeremy@jcline.org \
--to=jeremy@jcline.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+5ce571007a695806e949@syzkaller.appspotmail.com \
/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;
as well as URLs for NNTP newsgroup(s).