public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/5] fs: efs: fix possible memory leak
Date: Tue, 17 Feb 2015 19:31:01 +0000	[thread overview]
Message-ID: <20150217193101.GA11847@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1423731742-31383-4-git-send-email-sudipm.mukherjee@gmail.com>

On Thu, Feb 12, 2015 at 02:32:21PM +0530, Sudip Mukherjee wrote:
> we are allocating memory for struct efs_sb_info, but afterwards when
> we are returning with error we are not releasing the memory.

The hell we are not - unlike ->put_super(), ->kill_sb() is *always*
called, even when fill_super() fails halfway through.  Exactly because
it makes for simpler cleanup requirements on failure exits in said
fill_super().  And we have
static void efs_kill_sb(struct super_block *s)
{
        struct efs_sb_info *sbi = SUPER_INFO(s);
        kill_block_super(s);
        kfree(sbi);
}
for ->kill_sb() there, so sbi will *not* leak.

NAK.  This patch not only complicates efs_fill_super() for no good reason,
it ends up with double kfree() on those failure exits - ->s_fs_info is
left pointing to freed memory and efs_kill_sb() does kfree() again.

  reply	other threads:[~2015-02-17 19:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-12  9:02 [PATCH 1/5] fs: efs: fix trailing and leading space Sudip Mukherjee
2015-02-12  9:02 ` [PATCH 2/5] fs: efs: fix forward declarations Sudip Mukherjee
2015-02-12  9:02 ` [PATCH 3/5] fs: efs: remove nonexistant site Sudip Mukherjee
2015-02-12  9:02 ` [PATCH 4/5] fs: efs: fix possible memory leak Sudip Mukherjee
2015-02-17 19:31   ` Al Viro [this message]
2015-02-18 13:56     ` Sudip Mukherjee
2015-02-12  9:02 ` [PATCH 5/5] MAINTAINERS: remove website Sudip Mukherjee

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=20150217193101.GA11847@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.com \
    /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