* [PATCH] UDF symlink pathComponent header OOB read
@ 2026-07-17 10:47 David Lee
2026-07-17 12:03 ` Jan Kara
0 siblings, 1 reply; 2+ messages in thread
From: David Lee @ 2026-07-17 10:47 UTC (permalink / raw)
To: Jan Kara; +Cc: David Lee, linux-kernel, Dominik 'Disconnect3d' Czarnota
udf_symlink_filler() can enter udf_pc_to_char() with a partial pathComponent header.
Validate that enough input remains for a complete pathComponent header
before accessing it. Reject malformed symlink data that would otherwise
make udf_pc_to_char() perform an out-of-bounds read.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: David Lee <david.lee@trailofbits.com>
Assisted-by: Codex:gpt-5.5
---
Trail of Bits has a reproducer that triggers a kernel panic demonstrating
this bug and can share it if needed.
fs/udf/symlink.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c
index fe03745..a05d188 100644
--- a/fs/udf/symlink.c
+++ b/fs/udf/symlink.c
@@ -36,6 +36,8 @@ static int udf_pc_to_char(struct super_block *sb, unsigned char *from,
/* Reserve one byte for terminating \0 */
tolen--;
while (elen < fromlen) {
+ if (fromlen - elen < sizeof(struct pathComponent))
+ return -EIO;
pc = (struct pathComponent *)(from + elen);
elen += sizeof(struct pathComponent);
switch (pc->componentType) {
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] UDF symlink pathComponent header OOB read
2026-07-17 10:47 [PATCH] UDF symlink pathComponent header OOB read David Lee
@ 2026-07-17 12:03 ` Jan Kara
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2026-07-17 12:03 UTC (permalink / raw)
To: David Lee; +Cc: Jan Kara, linux-kernel, Dominik 'Disconnect3d' Czarnota
On Fri 17-07-26 10:47:21, David Lee wrote:
> udf_symlink_filler() can enter udf_pc_to_char() with a partial pathComponent header.
>
> Validate that enough input remains for a complete pathComponent header
> before accessing it. Reject malformed symlink data that would otherwise
> make udf_pc_to_char() perform an out-of-bounds read.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: David Lee <david.lee@trailofbits.com>
> Assisted-by: Codex:gpt-5.5
Thanks! I've added the patch to my tree.
Honza
> ---
> Trail of Bits has a reproducer that triggers a kernel panic demonstrating
> this bug and can share it if needed.
>
> fs/udf/symlink.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c
> index fe03745..a05d188 100644
> --- a/fs/udf/symlink.c
> +++ b/fs/udf/symlink.c
> @@ -36,6 +36,8 @@ static int udf_pc_to_char(struct super_block *sb, unsigned char *from,
> /* Reserve one byte for terminating \0 */
> tolen--;
> while (elen < fromlen) {
> + if (fromlen - elen < sizeof(struct pathComponent))
> + return -EIO;
> pc = (struct pathComponent *)(from + elen);
> elen += sizeof(struct pathComponent);
> switch (pc->componentType) {
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-17 12:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-17 10:47 [PATCH] UDF symlink pathComponent header OOB read David Lee
2026-07-17 12:03 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox