From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Jan Kara <jack@suse.cz>, Yunpeng Tian <shionthanatos@gmail.com>,
Gongming Wang <gmwgg05@gmail.com>, Mingda Zhang <npczmd@qq.com>,
Qinrun Dai <jupmouse@gmail.com>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.1.y 2/2] udf: Make sure there's enough space for LVID implementation use field
Date: Tue, 10 Nov 2026 07:03:57 -0500 [thread overview]
Message-ID: <20261110120351.946680-2-sashal@kernel.org> (raw)
In-Reply-To: <20261110120351.946680-1-sashal@kernel.org>
From: Jan Kara <jack@suse.cz>
[ Upstream commit a61fb39759d719a4f4966742b4d28387e33d81c4 ]
udf_lvid_valid() verifies that the LVID has enough space for all the
tables and the reported length of ImplementationUse field. However it
doesn't make sure the reported length is large enough to contain
logicalVolIntegrityDescImpUse structure which OSTA specification
requires. This can thus lead to accesses beyond the end of LVID buffer
for suitably corrupted UDF filesystem. Add the length check.
Reported-by: Yunpeng Tian <shionthanatos@gmail.com>
Reported-by: Gongming Wang <gmwgg05@gmail.com>
Reported-by: Mingda Zhang <npczmd@qq.com>
Reported-by: Qinrun Dai <jupmouse@gmail.com>
Cc: stable@vger.kernel.org
Fixes: 781d2a9a2fc7 ("udf: Check LVID earlier")
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/udf/super.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/udf/super.c b/fs/udf/super.c
index b091cc98406b4..f924a814874b3 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1581,7 +1581,10 @@ static bool udf_lvid_valid(struct super_block *sb,
parts = le32_to_cpu(lvid->numOfPartitions);
impuselen = le32_to_cpu(lvid->lengthOfImpUse);
- if (parts >= sb->s_blocksize || impuselen >= sb->s_blocksize ||
+ if (sizeof(struct logicalVolIntegrityDescImpUse) > impuselen ||
+ impuselen >= sb->s_blocksize)
+ return false;
+ if (parts >= sb->s_blocksize ||
sizeof(struct logicalVolIntegrityDesc) + impuselen +
2 * parts * sizeof(u32) > sb->s_blocksize)
return false;
--
2.53.0
prev parent reply other threads:[~2026-11-10 12:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 10:40 FAILED: patch "[PATCH] udf: Make sure there's enough space for LVID implementation use field" failed to apply to 6.1-stable tree Sasha Levin
2026-11-10 12:03 ` [PATCH 6.1.y 1/2] udf: Avoid invalid LVID used on mount Sasha Levin
2026-11-10 12:03 ` Sasha Levin [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=20261110120351.946680-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=gmwgg05@gmail.com \
--cc=jack@suse.cz \
--cc=jupmouse@gmail.com \
--cc=npczmd@qq.com \
--cc=shionthanatos@gmail.com \
--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