Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[cascardo/linux.git] / fs / ubifs / journal.c
index fb166e2..f6ac3f2 100644 (file)
@@ -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;