[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1414781431-2911-2-git-send-email-ben.shelton@ni.com>
Date: Fri, 31 Oct 2014 13:50:28 -0500
From: Ben Shelton <ben.shelton@...com>
To: linux-mtd@...ts.infradead.org
Cc: dedekind1@...il.com, adrian.hunter@...el.com,
linux-kernel@...r.kernel.org,
Subodh Nijsure <snijsure@...d-net.com>,
Marc Kleine-Budde <mkl@...gutronix.de>,
Ben Shelton <ben.shelton@...com>
Subject: [PATCH 1/4] UBIFS: fix a couple bugs in UBIFS xattr length calculation
From: Subodh Nijsure <snijsure@...d-net.com>
Signed-off-by: Subodh Nijsure <snijsure@...d-net.com>
Signed-off-by: Marc Kleine-Budde <mkl@...gutronix.de>
Signed-off-by: Ben Shelton <ben.shelton@...com>
Acked-by: Brad Mouring <brad.mouring@...com>
Acked-by: Gratian Crisan <gratian.crisan@...com>
---
fs/ubifs/journal.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
index fb166e2..7d90f13 100644
--- a/fs/ubifs/journal.c
+++ b/fs/ubifs/journal.c
@@ -571,7 +571,13 @@ 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 account for dir_ui->data_len in the length calculation
+ * in case there is an extended attribute.
+ */
+ len = aligned_dlen + aligned_ilen +
+ UBIFS_INO_NODE_SZ + dir_ui->data_len;
dent = kmalloc(len, GFP_NOFS);
if (!dent)
return -ENOMEM;
@@ -648,7 +654,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 + dir_ui->data_len);
if (err)
goto out_ro;
--
2.1.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists