Linux filesystem development
 help / color / mirror / Atom feed
* [PATCH] vboxsf: validate directory entry name length
@ 2026-07-10  2:31 Michael Bommarito
  0 siblings, 0 replies; only message in thread
From: Michael Bommarito @ 2026-07-10  2:31 UTC (permalink / raw)
  To: Hans de Goede; +Cc: linux-fsdevel, linux-kernel

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-10  2:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-10  2:31 [PATCH] vboxsf: validate directory entry name length Michael Bommarito

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