login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
April
»
13
Re: [PATCH] JFS: Free sbi memory in error path
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
[view in full thread]
From: Jan Blunck
Subject:
Re: [PATCH] JFS: Free sbi memory in error path
Date: Tuesday, April 13, 2010 - 12:58 am
On Mon, Apr 12, Andrew Morton wrote:
quoted text
> On Mon, 12 Apr 2010 18:40:17 +0200 > Jan Blunck <jblunck@suse.de> wrote: > > > I spotted the missing kfree() while removing the BKL. > > > > Signed-off-by: Jan Blunck <jblunck@suse.de> > > --- > > fs/jfs/super.c | 1 + > > 1 files changed, 1 insertions(+), 0 deletions(-) > > > > diff --git a/fs/jfs/super.c b/fs/jfs/super.c > > index 266699d..a402b7d 100644 > > --- a/fs/jfs/super.c > > +++ b/fs/jfs/super.c > > @@ -457,6 +457,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) > > > > if (newLVSize) { > > printk(KERN_ERR "resize option for remount only\n"); > > + kfree(sbi); > > return -EINVAL; > > } > > It'd be best to remove those multiple return statements so that leaks > of this nature are less likely to be reintroduced: >
Of course. Thanks Andrew. Jan
quoted text
> > From: Jan Blunck <jblunck@suse.de> > > I spotted the missing kfree() while removing the BKL. > > [akpm@linux-foundation.org: avoid multiple returns so it doesn't happen again] > Signed-off-by: Jan Blunck <jblunck@suse.de> > Cc: Dave Kleikamp <shaggy@austin.ibm.com> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org> > --- > > fs/jfs/super.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff -puN fs/jfs/super.c~jfs-free-sbi-memory-in-error-path fs/jfs/super.c > --- a/fs/jfs/super.c~jfs-free-sbi-memory-in-error-path > +++ a/fs/jfs/super.c > @@ -446,10 +446,8 @@ static int jfs_fill_super(struct super_b > /* initialize the mount flag and determine the default error handler */ > flag = JFS_ERR_REMOUNT_RO; > > - if (!parse_options((char *) data, sb, &newLVSize, &flag)) { > - kfree(sbi); > - return -EINVAL; > - } > + if (!parse_options((char *) data, sb, &newLVSize, &flag)) > + goto out_kfree; > sbi->flag = flag; > > #ifdef CONFIG_JFS_POSIX_ACL > @@ -458,7 +456,7 @@ static int jfs_fill_super(struct super_b > > if (newLVSize) { > printk(KERN_ERR "resize option for remount only\n"); > - return -EINVAL; > + goto out_kfree; > } > > /* > @@ -478,7 +476,7 @@ static int jfs_fill_super(struct super_b > inode = new_inode(sb); > if (inode == NULL) { > ret = -ENOMEM; > - goto out_kfree; > + goto out_unload; > } > inode->i_ino = 0; > inode->i_nlink = 1; > @@ -550,9 +548,10 @@ out_mount_failed: > make_bad_inode(sbi->direct_inode); > iput(sbi->direct_inode); > sbi->direct_inode = NULL; > -out_kfree: > +out_unload: > if (sbi->nls_tab) > unload_nls(sbi->nls_tab); > +out_kfree: > kfree(sbi); > return ret; > } > _ >
Regards, Jan -- Jan Blunck <jblunck@suse.de> --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
Messages in current thread:
[PATCH] JFS: Free sbi memory in error path
, Jan Blunck
, (Mon Apr 12, 9:40 am)
Re: [PATCH] JFS: Free sbi memory in error path
, Andrew Morton
, (Mon Apr 12, 4:44 pm)
Re: [PATCH] JFS: Free sbi memory in error path
, Jan Blunck
, (Tue Apr 13, 12:58 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Ingo Molnar
Re: [patch] e1000=y && e1000e=m regression fix
Greg Kroah-Hartman
[PATCH 20/36] Driver core: Call device_pm_add() after bus_add_device() in device_a...
Eli Cohen
Re: LRO num of frags limit
Boaz Harrosh
how to use KBUILD_EXTRA_SYMBOLS
Pekka Enberg
Re: [PATCH] include/linux/slab.h: new KFREE() macro.
git
:
Bill Lear
cpio command not found
Jing Xue
Re: git rm --cached
Fredrik Kuivinen
Re: fatal: unable to create '.git/index': File exists
Michael S. Tsirkin
git-kill: rewrite history removing a commit
Johannes Sixt
Re: How to pull remote branch with specified commit id?
linux-netdev
:
Johann Baudy
Packet mmap: TX RING and zero copy
Stephen Hemminger
Re: NAPI, rx_no_buffer_count, e1000, r8169 and other actors
Jamie Lokier
Re: POHMELFS high performance network filesystem. Transactions, failover, performa...
Balazs Scheidler
Re: [PATCH 5/9] tproxy: allow non-local binds of IPv6 sockets if IP_TRANSPARENT is...
Paulius Zaleckas
Re: [RFC] Patch to option HSO driver to the kernel
openbsd-misc
:
Bryan Irvine
Re: DVD burn error: No space left on device
Netmaffia.hu
Tini Lányok AKCIÓBAN OTTHON
Siju George
This is what Linus Torvalds calls openBSD crowd
elitdostlar
Seks partneri arayan bayanlar bu adreste - 8878xs706x6438
Skylar Hawk
Re: asus eee 1201n - acpitz0 critical temperature 255C (5282K), shutting down
git-commits-head
:
Linux Kernel Mailing List
Linux 2.6.34-rc4
Linux Kernel Mailing List
x86 boot: only pick up additional EFI memmap if add_efi_memmap flag
Linux Kernel Mailing List
powerpc/fsl_msi: enable msi allocation in all banks
Linux Kernel Mailing List
[ALSA] hda-codec - Add support for VIA VT1708B HD audio codec
Linux Kernel Mailing List
ARM: dma-mapping: remove dmac_clean_range and dmac_inv_range
Colocation donated by:
Syndicate