Fixed expanding $STANDARD_INFORMATION with almost-full MFT record
When setting a security descriptor on an NTFS v1.2 format file in an NTFS v3.0+ volume, NTFS-3G would migrate $STANDARD_INFORMATION to the new format, which requires extending its size from 48 to 72 bytes. If this happened while the file's MFT record was almost full, and none of the file's attributes could be made non-resident, and the file did not have an attribute list attribute, then the operation would unexpectedly fail with ENOENT. Fix this by adding an attribute list to the file in this situation. (contributed by Eric Biggers)pull/2/head
parent
17b56ccfa2
commit
7a0cf11e1c
|
@ -5142,6 +5142,10 @@ static int ntfs_resident_attr_resize_i(ntfs_attr *na, const s64 newsize,
|
|||
*/
|
||||
if (na->type==AT_STANDARD_INFORMATION || na->type==AT_ATTRIBUTE_LIST) {
|
||||
ntfs_attr_put_search_ctx(ctx);
|
||||
if (!NInoAttrList(na->ni) && ntfs_inode_add_attrlist(na->ni)) {
|
||||
ntfs_log_perror("Could not add attribute list");
|
||||
return -1;
|
||||
}
|
||||
if (ntfs_inode_free_space(na->ni, offsetof(ATTR_RECORD,
|
||||
non_resident_end) + 8)) {
|
||||
ntfs_log_perror("Could not free space in MFT record");
|
||||
|
|
Loading…
Reference in New Issue