summaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorSubodh Nijsure <snijsure@grid-net.com>2014-10-31 13:50:28 -0500
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2014-11-07 12:32:22 +0200
commita76284e6f89b2ae37d413fe793752257be01765a (patch)
tree392297d678f93cba99e06ca4758277fd1bc69291 /fs/ubifs
parentb81000b69ae99fdd77246e22ebf762a5dd008c1e (diff)
downloadop-kernel-dev-a76284e6f89b2ae37d413fe793752257be01765a.zip
op-kernel-dev-a76284e6f89b2ae37d413fe793752257be01765a.tar.gz
UBIFS: fix a couple bugs in UBIFS xattr length calculation
The journal update function did not work for extended attributes properly, because extended attribute inodes carry the xattr data, and the size of this data was not taken into account. Artem: improved commit message, amended the patch a bit. Signed-off-by: Subodh Nijsure <snijsure@grid-net.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Ben Shelton <ben.shelton@ni.com> Acked-by: Brad Mouring <brad.mouring@ni.com> Acked-by: Gratian Crisan <gratian.crisan@ni.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/journal.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
index fb166e2..f6ac3f2 100644
--- a/fs/ubifs/journal.c
+++ b/fs/ubifs/journal.c
@@ -571,7 +571,11 @@ int ubifs_jnl_update(struct ubifs_info *c, const struct inode *dir,
aligned_dlen = ALIGN(dlen, 8);
aligned_ilen = ALIGN(ilen, 8);
+
len = aligned_dlen + aligned_ilen + UBIFS_INO_NODE_SZ;
+ /* Make sure to also account for extended attributes */
+ len += host_ui->data_len;
+
dent = kmalloc(len, GFP_NOFS);
if (!dent)
return -ENOMEM;
@@ -648,7 +652,8 @@ int ubifs_jnl_update(struct ubifs_info *c, const struct inode *dir,
ino_key_init(c, &ino_key, dir->i_ino);
ino_offs += aligned_ilen;
- err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs, UBIFS_INO_NODE_SZ);
+ err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs,
+ UBIFS_INO_NODE_SZ + host_ui->data_len);
if (err)
goto out_ro;
OpenPOWER on IntegriCloud