diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c index 4de597a83b88..0fdb74695420 100644 --- a/fs/ntfs/attrib.c +++ b/fs/ntfs/attrib.c @@ -603,6 +603,9 @@ static int ntfs_attr_find(const ATTR_TYPE type, const ntfschar *name, break; if (a->type != type) continue; + if (sizeof(ntfschar) * a->name_length + + le16_to_cpu(a->name_offset) >= a->length) + return -EFAULT; /* * If @name is present, compare the two names. If @name is * missing, assume we want an unnamed attribute.