Skip to content

Commit

Permalink
UBIFS: fix a couple bugs in UBIFS xattr length calculation
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Marc Kleine-Budde <[email protected]>
Signed-off-by: Ben Shelton <[email protected]>
Acked-by: Brad Mouring <[email protected]>
Acked-by: Gratian Crisan <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
  • Loading branch information
Subodh Nijsure authored and dedekind committed Nov 7, 2014
1 parent b81000b commit a76284e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fs/ubifs/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit a76284e

Please sign in to comment.