From: Michael Bommarito <michael.bommarito@gmail.com>
To: Hans de Goede <hansg@kernel.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] vboxsf: validate directory entry name length
Date: Thu, 9 Jul 2026 22:31:56 -0400 [thread overview]
Message-ID: <20260710023156.3749541-1-michael.bommarito@gmail.com> (raw)
Shared-folder dir entries carry host-reported size and length fields.
vboxsf_dir_emit() checks that name.size fits in the returned buffer, but
later passes name.length to vboxsf_nlscpy() or dir_emit() unchecked, so
malformed host data can make the guest read past the shfl_string buffer.
Reject entries whose name.length exceeds name.size before either consumer.
Fixes: 0fd169576648 ("fs: Add VirtualBox guest shared folder (vboxsf) support")
Assisted-by: Claude:claude-fable-5
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
---
fs/vboxsf/dir.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/vboxsf/dir.c b/fs/vboxsf/dir.c
index 42bedc4ec7af7..702d243169936 100644
--- a/fs/vboxsf/dir.c
+++ b/fs/vboxsf/dir.c
@@ -129,6 +129,8 @@ static bool vboxsf_dir_emit(struct file *dir, struct dir_context *ctx)
end = &info->name.string.utf8[info->name.size];
if (WARN_ON(end > (b->buf + b->used)))
return false;
+ if (info->name.length > info->name.size)
+ return false;
/* Info now points to the right entry, emit it. */
d_type = vboxsf_get_d_type(info->info.attr.mode);
--
2.53.0
reply other threads:[~2026-07-10 2:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260710023156.3749541-1-michael.bommarito@gmail.com \
--to=michael.bommarito@gmail.com \
--cc=hansg@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--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