Skip to content

Commit

Permalink
ubifs: switch to fscrypt_prepare_setattr()
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Biggers <[email protected]>
Signed-off-by: Richard Weinberger <[email protected]>
  • Loading branch information
ebiggers authored and richardweinberger committed Jan 17, 2018
1 parent a0b3ccd commit 252153b
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions fs/ubifs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1284,13 +1284,9 @@ int ubifs_setattr(struct dentry *dentry, struct iattr *attr)
if (err)
return err;

if (ubifs_crypt_is_encrypted(inode) && (attr->ia_valid & ATTR_SIZE)) {
err = fscrypt_get_encryption_info(inode);
if (err)
return err;
if (!fscrypt_has_encryption_key(inode))
return -ENOKEY;
}
err = fscrypt_prepare_setattr(dentry, attr);
if (err)
return err;

if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size < inode->i_size)
/* Truncation to a smaller size */
Expand Down

0 comments on commit 252153b

Please sign in to comment.