lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100704113711.GA15067@hash.localnet>
Date:	Sun, 4 Jul 2010 07:37:11 -0400
From:	me@...copeland.com
To:	Davidlohr Bueso <dave.bueso@...il.com>
Cc:	linux-karma-devel@...ts.sourceforge.net,
	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] omfs: fix memory leak

On Sat, Jul 03, 2010 at 10:33:48PM -0400, Davidlohr Bueso wrote:
> Hi,
> 
> In omfs_fill_super(), when returning on error, sbi is not being freed.
> 
> Thanks,
> Davidlohr.

Hi Davidlohr,

I don't think this is right:

fill_super:
  err = omfs_fill_super()
  if (err)
     deactivate_locked_super(sb)
        kill_sb()
          generic_shutdown_super()
            sop->put_super()
  ...
  omfs_put_super()
    kfree(sbi->s_imap);
    kfree(sbi);

So your change would cause a crash at the first kfree in omfs_put_super().

It looks fine to me as-is, or am I missing something?

> 
> Signed-off-by: Davidlohr Bueso <dave@....org>
> ---
>  fs/omfs/inode.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
> index 089839a..253846e 100644
> --- a/fs/omfs/inode.c
> +++ b/fs/omfs/inode.c
> @@ -523,12 +523,14 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent)
>  	}
>  	printk(KERN_DEBUG "omfs: Mounted volume %s\n", omfs_rb->r_name);
>  
> -	ret = 0;
> +	ret = 0; /* success */
>  out_brelse_bh2:
>  	brelse(bh2);
>  out_brelse_bh:
>  	brelse(bh);
>  end:
> +	if (ret != 0)
> +		kfree(sbi);
>  	return ret;
>  }

-- 
Bob Copeland %% www.bobcopeland.com

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ