summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/ntfs/attrib.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
index 1e0076ef81ef..1cd6664567ce 100644
--- a/fs/ntfs/attrib.c
+++ b/fs/ntfs/attrib.c
@@ -596,6 +596,22 @@ static u32 ntfs_resident_attr_min_value_length(const __le32 type)
}
}
+static bool ntfs_attr_type_is_resident_only(const __le32 type)
+{
+ switch (type) {
+ case AT_STANDARD_INFORMATION:
+ case AT_FILE_NAME:
+ case AT_OBJECT_ID:
+ case AT_VOLUME_NAME:
+ case AT_VOLUME_INFORMATION:
+ case AT_INDEX_ROOT:
+ case AT_EA_INFORMATION:
+ return true;
+ default:
+ return false;
+ }
+}
+
static bool ntfs_file_name_attr_value_is_valid(const u8 *value, const u32 value_length)
{
const struct file_name_attr *fn;
@@ -666,7 +682,7 @@ static bool ntfs_attr_value_is_valid(struct ntfs_volume *vol,
u32 min_len;
if (a->non_resident) {
- if (a->type == AT_FILE_NAME || a->type == AT_VOLUME_NAME)
+ if (ntfs_attr_type_is_resident_only(a->type))
goto corrupt;
if (!ntfs_non_resident_attr_value_is_valid(a))
goto corrupt;