aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ntfs3
diff options
context:
space:
mode:
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2021-09-08 18:39:53 +0300
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2021-09-21 18:36:40 +0300
commitee9d4810aab95208541d2807f9d114f1d5edcee0 (patch)
tree26a3bf3fa2d2d3e5ecdf9f8c4c9c3a9f8660d1e9 /fs/ntfs3
parentfs/ntfs3: Fix a memory leak on object opts (diff)
downloadlinux-dev-ee9d4810aab95208541d2807f9d114f1d5edcee0.tar.xz
linux-dev-ee9d4810aab95208541d2807f9d114f1d5edcee0.zip
fs/ntfs3: Fix insertion of attr in ni_ins_attr_ext
Do not try to insert attribute if there is no room in record. Reviewed-by: Kari Argillander <kari.argillander@gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3')
-rw-r--r--fs/ntfs3/frecord.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index 1e1a09034f65..0d00b2301a2f 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -953,6 +953,13 @@ static int ni_ins_attr_ext(struct ntfs_inode *ni, struct ATTR_LIST_ENTRY *le,
continue;
}
+ /*
+ * Do not try to insert this attribute
+ * if there is no room in record.
+ */
+ if (le32_to_cpu(mi->mrec->used) + asize > sbi->record_size)
+ continue;
+
/* Try to insert attribute into this subrecord. */
attr = ni_ins_new_attr(ni, mi, le, type, name, name_len, asize,
name_off, svcn, ins_le);