From: Davidlohr Bueso <dave.bueso@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH fs/ramfs] inode.c: Fix incorrect variable freeing.
Date: Sun, 20 Jun 2010 15:27:37 -0400 [thread overview]
Message-ID: <1277062057.14428.0.camel@cowboy> (raw)
Hi,
In ramfs_fill_super(), if fsi's memory allocation fails, it will go to 'fail',
which immediately tries to free the variable, potentially producing an Oops.
This patch addresses this issue.
Thanks.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
fs/ramfs/inode.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index a5ebae7..40af7a2 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -219,7 +219,7 @@ int ramfs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_fs_info = fsi;
if (!fsi) {
err = -ENOMEM;
- goto fail;
+ goto fail2;
}
err = ramfs_parse_options(data, &fsi->mount_opts);
@@ -247,11 +247,13 @@ int ramfs_fill_super(struct super_block *sb, void *data, int silent)
}
return 0;
-fail:
- kfree(fsi);
+fail2:
sb->s_fs_info = NULL;
iput(inode);
return err;
+fail:
+ kfree(fsi);
+ goto fail2;
}
int ramfs_get_sb(struct file_system_type *fs_type,
--
1.7.0.4
next reply other threads:[~2010-06-20 19:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-20 19:27 Davidlohr Bueso [this message]
2010-06-22 19:41 ` [PATCH fs/ramfs] inode.c: Fix incorrect variable freeing Andrew Morton
2010-06-23 13:20 ` Davidlohr Bueso
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=1277062057.14428.0.camel@cowboy \
--to=dave.bueso@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).