public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6.1/5.15/5.10/5.4] udf: fix null-ptr-deref if sb_getblk() fails
@ 2024-11-29 10:58 Jakub Acs
  2024-11-29 12:15 ` Greg KH
  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
  0 siblings, 2 replies; 9+ messages in thread
From: Jakub Acs @ 2024-11-29 10:58 UTC (permalink / raw)
  To: Jan Kara, stable; +Cc: Jakub Acs, Jakub Acs

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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-12-05 14:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-29 10:58 [PATCH 6.1/5.15/5.10/5.4] udf: fix null-ptr-deref if sb_getblk() fails Jakub Acs
2024-11-29 12:15 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox