[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1566270227-8302-1-git-send-email-wenwen@cs.uga.edu>
Date: Mon, 19 Aug 2019 22:03:46 -0500
From: Wenwen Wang <wenwen@...uga.edu>
To: Wenwen Wang <wenwen@...uga.edu>
Cc: Richard Weinberger <richard@....at>,
Artem Bityutskiy <dedekind1@...il.com>,
Adrian Hunter <adrian.hunter@...el.com>,
linux-mtd@...ts.infradead.org (open list:UBI FILE SYSTEM (UBIFS)),
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH] ubifs: fix a memory leak bug
In read_znode(), the indexing node 'idx' is allocated by kmalloc().
However, it is not deallocated in the following execution if
ubifs_node_check_hash() fails, leading to a memory leak bug. To fix this
issue, free 'idx' before returning the error.
Signed-off-by: Wenwen Wang <wenwen@...uga.edu>
---
fs/ubifs/tnc_misc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/ubifs/tnc_misc.c b/fs/ubifs/tnc_misc.c
index 6f293f6..49cb34c 100644
--- a/fs/ubifs/tnc_misc.c
+++ b/fs/ubifs/tnc_misc.c
@@ -284,6 +284,7 @@ static int read_znode(struct ubifs_info *c, struct ubifs_zbranch *zzbr,
err = ubifs_node_check_hash(c, idx, zzbr->hash);
if (err) {
ubifs_bad_hash(c, idx, zzbr->hash, lnum, offs);
+ kfree(idx);
return err;
}
--
2.7.4
Powered by blists - more mailing lists