Unverified Commit ee9d4810 authored by Konstantin Komarov's avatar Konstantin Komarov
Browse files

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: default avatarKari Argillander <kari.argillander@gmail.com>
Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
parent 880301bb
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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);