From: Jakub Acs <acsjakub@amazon.com>
To: Jan Kara <jack@suse.cz>, <stable@vger.kernel.org>
Cc: Jakub Acs <acsjakub@amazon.com>, Jakub Acs <acsjakub@amazon.de>
Subject: [PATCH 6.1/5.15/5.10/5.4] udf: fix null-ptr-deref if sb_getblk() fails
Date: Fri, 29 Nov 2024 10:58:46 +0000 [thread overview]
Message-ID: <20241129105846.4698-1-acsjakub@amazon.com> (raw)
commit 32f123a3f342 ("udf: Fold udf_getblk() into udf_bread()"), fixes a
null-ptr-deref bug as a side effect. Backport the null-ptr-deref fixing
aspect of the aforementioned commit.
Closes: https://syzkaller.appspot.com/bug?extid=a38e34ca637c224f4a79
Signed-off-by: Jakub Acs <acsjakub@amazon.de>
---
fs/udf/inode.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index d7d6ccd0af06..4f505a366da9 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -380,6 +380,10 @@ static struct buffer_head *udf_getblk(struct inode *inode, udf_pblk_t block,
*err = udf_get_block(inode, block, &dummy, create);
if (!*err && buffer_mapped(&dummy)) {
bh = sb_getblk(inode->i_sb, dummy.b_blocknr);
+ if (!bh) {
+ *err = -ENOMEM;
+ return NULL;
+ }
if (buffer_new(&dummy)) {
lock_buffer(bh);
memset(bh->b_data, 0x00, inode->i_sb->s_blocksize);
base-commit: e4d90d63d385228b1e0bcf31cc15539bbbc28f7f
--
2.40.1
next reply other threads:[~2024-11-29 10:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-29 10:58 Jakub Acs [this message]
2024-11-29 12:15 ` [PATCH 6.1/5.15/5.10/5.4] udf: fix null-ptr-deref if sb_getblk() fails Greg KH
2024-12-04 9:32 ` [PATCH v2 6.1] udf: Fold udf_getblk() into udf_bread() Jakub Acs
2024-12-04 10:08 ` Jan Kara
2024-12-04 15:41 ` Sasha Levin
2024-12-04 22:11 ` Sasha Levin
2024-12-05 9:29 ` [PATCH v3 " Jakub Acs
2024-12-05 13:34 ` Sasha Levin
2024-11-29 20:03 ` [PATCH 6.1/5.15/5.10/5.4] udf: fix null-ptr-deref if sb_getblk() fails Sasha Levin
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=20241129105846.4698-1-acsjakub@amazon.com \
--to=acsjakub@amazon.com \
--cc=acsjakub@amazon.de \
--cc=jack@suse.cz \
--cc=stable@vger.kernel.org \
/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