From: Sascha Hauer <s.hauer@pengutronix.de>
To: linux-mtd@lists.infradead.org
Cc: Richard Weinberger <richard@nod.at>,
Wenwen Wang <wenwen@cs.uga.edu>,
Sascha Hauer <s.hauer@pengutronix.de>,
kernel@pengutronix.de
Subject: [PATCH] Revert "ubifs: Fix memory leak bug in alloc_ubifs_info() error path"
Date: Wed, 30 Oct 2019 15:52:01 +0100 [thread overview]
Message-ID: <20191030145201.3597-1-s.hauer@pengutronix.de> (raw)
This reverts commit 9163e0184bd7d5f779934d34581843f699ad2ffd.
There actually is no memory leak. After an sget() the ubifs info
structure will be freed in the kill_sb hook. Doing it again here
leads to a double free.
As this is non obvious leave a comment where c is freed.
Fixes: 9163e0184bd7 ("ubifs: Fix memory leak bug in alloc_ubifs_info() error path")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/ubifs/super.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 7d4547e5202d..ce1515d693a0 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -2267,10 +2267,9 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags,
}
} else {
err = ubifs_fill_super(sb, data, flags & SB_SILENT ? 1 : 0);
- if (err) {
- kfree(c);
+ if (err)
+ /* c will be freed in ubifs_fs_type.kill_sb */
goto out_deact;
- }
/* We do not support atime */
sb->s_flags |= SB_ACTIVE;
if (IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
--
2.24.0.rc1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next reply other threads:[~2019-10-30 14:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-30 14:52 Sascha Hauer [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-10-24 8:25 [PATCH] Revert "ubifs: Fix memory leak bug in alloc_ubifs_info() error path" Richard Weinberger
2019-11-15 13:21 ` Romain Izard
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=20191030145201.3597-1-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=kernel@pengutronix.de \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=wenwen@cs.uga.edu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox