[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1360750998-15191-3-git-send-email-mkl@pengutronix.de>
Date: Wed, 13 Feb 2013 11:23:15 +0100
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: linux-mtd@...ts.infradead.org
Cc: kernel@...gutronix.de, artem.bityutskiy@...ux.intel.com,
linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org,
Subodh Nijsure <snijsure@...d-net.com>,
Marc Kleine-Budde <mkl@...gutronix.de>
Subject: [PATCH RFC 2/5] UBIFS: fix couple bugs in UBIFS extended attribute 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>
---
fs/ubifs/journal.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
index afaad07..6981d7d 100644
--- a/fs/ubifs/journal.c
+++ b/fs/ubifs/journal.c
@@ -572,7 +572,12 @@ 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 length
+ * calculation in case there is extended attribute.
+ */
+ len = aligned_dlen + aligned_ilen +
+ UBIFS_INO_NODE_SZ + dir_ui->data_len;
dent = kmalloc(len, GFP_NOFS);
if (!dent)
return -ENOMEM;
@@ -649,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;
--
1.7.10.4
--
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