From: Wenchao Hao <haowenchao2@huawei.com>
To: Jan Kara <jack@suse.com>, <linux-kernel@vger.kernel.org>
Cc: <linfeilong@huawei.com>, Wenchao Hao <haowenchao2@huawei.com>
Subject: [PATCH 2/2] udf:check if buffer head's data when getting lvidiu
Date: Tue, 13 Jun 2023 11:22:54 +0800 [thread overview]
Message-ID: <20230613032254.1235752-3-haowenchao2@huawei.com> (raw)
In-Reply-To: <20230613032254.1235752-1-haowenchao2@huawei.com>
We can not always assume udf_sb_info->s_lvid_bh's data is valid. If the
data is corrupted, we would get an incorrect offset and cause the
following code access an illegal address.
Signed-off-by: Wenchao Hao <haowenchao2@huawei.com>
---
fs/udf/super.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 6304e3c5c3d9..71481b60c871 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -114,6 +114,8 @@ struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct super_block *sb)
if (!UDF_SB(sb)->s_lvid_bh)
return NULL;
+ if (!udf_check_tagged_bh(sb, UDF_SB(sb)->s_lvid_bh))
+ return NULL;
lvid = (struct logicalVolIntegrityDesc *)UDF_SB(sb)->s_lvid_bh->b_data;
partnum = le32_to_cpu(lvid->numOfPartitions);
/* The offset is to skip freeSpaceTable and sizeTable arrays */
--
2.35.3
prev parent reply other threads:[~2023-06-12 14:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-13 3:22 [PATCH 0/2] Fix out-of-bound access if pagecache of udf device is corrupted Wenchao Hao
2023-06-12 14:40 ` Jan Kara
2023-06-13 1:43 ` haowenchao (C)
2023-06-13 3:22 ` [PATCH 1/2] udf: add helper function udf_check_tagged_bh to check tagged page Wenchao Hao
2023-06-13 3:22 ` Wenchao Hao [this message]
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=20230613032254.1235752-3-haowenchao2@huawei.com \
--to=haowenchao2@huawei.com \
--cc=jack@suse.com \
--cc=linfeilong@huawei.com \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®