diff options
author | Richard Weinberger <richard@nod.at> | 2016-10-20 16:47:56 +0200 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2016-12-12 23:07:38 +0100 |
commit | d475a507457b5cafa428871a473d0dcc828c5f68 (patch) | |
tree | 7f6608195cfc421e6d3d7975cc8b916a55e4a914 /fs/ubifs/xattr.c | |
parent | 6a5e98ab7d8665d2faddbd91a8a2bf9addb79aff (diff) |
ubifs: Add skeleton for fscrypto
This is the first building block to provide file level
encryption on UBIFS.
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/ubifs/xattr.c')
-rw-r--r-- | fs/ubifs/xattr.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c index 2d09dbeecd58..95a16028bbdb 100644 --- a/fs/ubifs/xattr.c +++ b/fs/ubifs/xattr.c @@ -158,6 +158,15 @@ static int create_xattr(struct ubifs_info *c, struct inode *host, host_ui->xattr_size += CALC_XATTR_BYTES(size); host_ui->xattr_names += nm->len; + /* + * We handle UBIFS_XATTR_NAME_ENCRYPTION_CONTEXT here because we + * have to set the UBIFS_CRYPT_FL flag on the host inode. + * To avoid multiple updates of the same inode in the same operation, + * let's do it here. + */ + if (strcmp(nm->name, UBIFS_XATTR_NAME_ENCRYPTION_CONTEXT) == 0) + host_ui->flags |= UBIFS_CRYPT_FL; + err = ubifs_jnl_update(c, host, nm, inode, 0, 1); if (err) goto out_cancel; @@ -173,6 +182,7 @@ out_cancel: host_ui->xattr_size -= CALC_DENT_SIZE(nm->len); host_ui->xattr_size -= CALC_XATTR_BYTES(size); host_ui->xattr_names -= nm->len; + host_ui->flags &= ~UBIFS_CRYPT_FL; mutex_unlock(&host_ui->ui_mutex); out_free: make_bad_inode(inode); |