From: Florian Fainelli <f.fainelli@gmail.com>
To: <dedekind1@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
computersforpeace@gmail.com, linux-mtd@lists.infradead.org
Subject: [PATCH] UBIFS: add missing znode freeing in tcn_insert()
Date: Fri, 7 Mar 2014 16:11:27 -0800 [thread overview]
Message-ID: <1394237487-2728-1-git-send-email-f.fainelli@gmail.com> (raw)
In case the zi allocation fails in the do_split label, we will fail
freeing zn that we allocated before, add a missing kfree.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
fs/ubifs/tnc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
index 9083bc7ed4ae..9b84d91ea530 100644
--- a/fs/ubifs/tnc.c
+++ b/fs/ubifs/tnc.c
@@ -2105,8 +2105,10 @@ do_split:
dbg_tnc("creating new zroot at level %d", znode->level + 1);
zi = kzalloc(c->max_znode_sz, GFP_NOFS);
- if (!zi)
+ if (!zi) {
+ kfree(zn);
return -ENOMEM;
+ }
zi->child_cnt = 2;
zi->level = znode->level + 1;
--
1.8.3.2
next reply other threads:[~2014-03-08 0:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-08 0:11 Florian Fainelli [this message]
2014-03-08 10:46 ` [PATCH] UBIFS: add missing znode freeing in tcn_insert() Richard Weinberger
2014-03-10 18:44 ` Florian Fainelli
2014-03-11 7:55 ` Artem Bityutskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394237487-2728-1-git-send-email-f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=computersforpeace@gmail.com \
--cc=dedekind1@gmail.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.