aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-06 10:08:56 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-13 12:23:57 -0400
commiteaeee242c531cd4b0a4a46e8b5dd7ef504380c42 (patch)
tree7009f5a79dd67d5eb29140b8cfe4c9dc11dfcae7 /fs
parentc1f1f91d2183b91c684900b529b6c336ad3dd27c (diff)
UBIFS: fix a rare memory leak in ro to rw remounting path
When re-mounting from R/O mode to R/W mode and the LEB count in the superblock is not up-to date, because for the underlying UBI volume became larger, we re-write the superblock. We allocate RAM for these purposes, but never free it. So this is a memory leak, although very rare one. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Cc: stable@kernel.org
Diffstat (limited to 'fs')
-rw-r--r--fs/ubifs/sb.c3
-rw-r--r--fs/ubifs/super.c1
2 files changed, 3 insertions, 1 deletions
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index bf31b4729e51..cad60b51f7c4 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -475,7 +475,8 @@ failed:
475 * @c: UBIFS file-system description object 475 * @c: UBIFS file-system description object
476 * 476 *
477 * This function returns a pointer to the superblock node or a negative error 477 * This function returns a pointer to the superblock node or a negative error
478 * code. 478 * code. Note, the user of this function is responsible of kfree()'ing the
479 * returned superblock buffer.
479 */ 480 */
480struct ubifs_sb_node *ubifs_read_sb_node(struct ubifs_info *c) 481struct ubifs_sb_node *ubifs_read_sb_node(struct ubifs_info *c)
481{ 482{
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 407c064fb1c1..575ea8353d08 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1585,6 +1585,7 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1585 } 1585 }
1586 sup->leb_cnt = cpu_to_le32(c->leb_cnt); 1586 sup->leb_cnt = cpu_to_le32(c->leb_cnt);
1587 err = ubifs_write_sb_node(c, sup); 1587 err = ubifs_write_sb_node(c, sup);
1588 kfree(sup);
1588 if (err) 1589 if (err)
1589 goto out; 1590 goto out;
1590 } 1591 }