From: Dave Jones <davej@redhat.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Dave Jones <davej@fedoraproject.org>,
Theodore Tso <tytso@mit.edu>, Eric Sandeen <sandeen@redhat.com>
Subject: Re: [ 05/11] ext4: fix memory leak in xattr
Date: Mon, 21 Oct 2013 12:37:32 -0400 [thread overview]
Message-ID: <20131021163732.GA16581@redhat.com> (raw)
In-Reply-To: <20131018195049.436649568@linuxfoundation.org>
On Fri, Oct 18, 2013 at 12:53:34PM -0700, Greg Kroah-Hartman wrote:
> 3.4-stable review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Dave Jones <davej@redhat.com>
>
> commit 6e4ea8e33b2057b85d75175dd89b93f5e26de3bc upstream.
>
> If we take the 2nd retry path in ext4_expand_extra_isize_ea, we
> potentionally return from the function without having freed these
> allocations. If we don't do the return, we over-write the previous
> allocation pointers, so we leak either way.
>
> Spotted with Coverity.
>
> [ Fixed by tytso to set is and bs to NULL after freeing these
> pointers, in case in the retry loop we later end up triggering an
> error causing a jump to cleanup, at which point we could have a double
> free bug. -- Ted ]
>
> Signed-off-by: Dave Jones <davej@fedoraproject.org>
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
I'm still waiting to hear if we also need this..
Ted ?
--
If we take the retry path here, we end up potentially overwriting bh, leaving
it with an elevated reference count.
Signed-off-by: Dave Jones <davej@fedoraproject.org>
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 03e9beb..1423c48 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1352,6 +1352,7 @@ retry:
new_extra_isize = s_min_extra_isize;
kfree(is); is = NULL;
kfree(bs); bs = NULL;
+ brelse(bh);
goto retry;
}
error = -1;
next prev parent reply other threads:[~2013-10-21 16:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-18 19:53 [ 00/11] 3.4.67-stable review Greg Kroah-Hartman
2013-10-18 19:53 ` [ 01/11] ALSA: snd-usb-usx2y: remove bogus frame checks Greg Kroah-Hartman
2013-10-18 19:53 ` [ 02/11] ALSA: hda - Add fixup for ASUS N56VZ Greg Kroah-Hartman
2013-10-18 19:53 ` [ 03/11] random: run random_int_secret_init() run after all late_initcalls Greg Kroah-Hartman
2013-10-18 19:53 ` [ 04/11] vfs: allow O_PATH file descriptors for fstatfs() Greg Kroah-Hartman
2013-10-18 19:53 ` [ 05/11] ext4: fix memory leak in xattr Greg Kroah-Hartman
2013-10-21 16:37 ` Dave Jones [this message]
2013-10-18 19:53 ` [ 06/11] KVM: PPC: Book3S HV: Fix typo in saving DSCR Greg Kroah-Hartman
2013-10-18 19:53 ` [ 07/11] parisc: fix interruption handler to respect pagefault_disable() Greg Kroah-Hartman
2013-10-18 19:53 ` [ 08/11] watchdog: ts72xx_wdt: locking bug in ioctl Greg Kroah-Hartman
2013-10-18 19:53 ` [ 09/11] drm/radeon: fix hw contexts for SUMO2 asics Greg Kroah-Hartman
2013-10-18 19:53 ` [ 10/11] mm/mmap: check for RLIMIT_AS before unmapping Greg Kroah-Hartman
2013-10-18 19:53 ` [ 11/11] mm: do not grow the stack vma just because of an overrun on preceding vma Greg Kroah-Hartman
2013-10-18 20:49 ` [ 00/11] 3.4.67-stable review Guenter Roeck
2013-10-18 21:25 ` Greg Kroah-Hartman
2013-10-19 3:41 ` Shuah Khan
2013-10-19 4:49 ` Greg Kroah-Hartman
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=20131021163732.GA16581@redhat.com \
--to=davej@redhat.com \
--cc=davej@fedoraproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tytso@mit.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;
as well as URLs for NNTP newsgroup(s).