mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: stable@vger.kernel.org
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	Andy Lutomirski <luto@amacapital.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Maciej Rutecki <maciej.rutecki@gmail.com>,
	Florian Mickler <florian@mickler.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Kernel Testers List <kernel-testers@vger.kernel.org>,
	Network Development <netdev@vger.kernel.org>,
	Linux ACPI <linux-acpi@vger.kernel.org>,
	Linux PM List <linux-pm@lists.linux-foundation.org>,
	Linux SCSI List <linux-scsi@vger.kernel.org>,
	Linux Wireless List <linux-wireless@vger.kernel.org>,
	DRI <dri-devel@lists.freedesktop.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH] hugetlb: release pages in the error path of hugetlb_cow() (was: Re: 3.2-rc2+: Reported regressions from 3.0 and 3.1)
Date: Mon, 28 Nov 2011 09:33:13 +0100	[thread overview]
Message-ID: <20111128083313.GA18337@tiehlicka.suse.cz> (raw)
In-Reply-To: <CA+55aFygSFt+O5KLoiE_0V+o45eKfsoDDV5ML8EF=J0n9z_D-Q@mail.gmail.com>

On Mon 21-11-11 14:18:29, Linus Torvalds wrote:
> On Mon, Nov 21, 2011 at 1:49 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> >
> > Subject    : hugetlb oops on 3.1.0-rc8-devel
> > Submitter  : Andy Lutomirski <luto@amacapital.net>
> > Date       : 2011-11-01 22:20
> > Message-ID : CALCETrW1mpVCz2tO5roaz1r6vnno+srHR-dHA6_pkRi2qiCfdw@mail.gmail.com
> > References : http://marc.info/?l=linux-kernel&m=132018604426692&w=2
> 
> Despite the subject line, that's not an oops, it's a BUG_ON().
> 
> And it *should* be fixed by commit ea4039a34c4c ("hugetlb: release
> pages in the error path of hugetlb_cow()") although I don't think Andy
> ever confirmed that (since it was hard to trigger).

AFAICS the issue has been introduced by 0fe6e20b (hugetlb, rmap:
add reverse mapping for hugepage) in 2.6.36-rc1 so this is a stable
material. I do not see the patch in any stable branch so here we go.
The patch is on top of 3.0.y branch and it applies as is to 3.1.y
as well.
---
>From fdaa4aaa008cce149a5fd60934112acd8988e0b6 Mon Sep 17 00:00:00 2001
From: Hillf Danton <dhillf@gmail.com>
Date: Tue, 15 Nov 2011 14:36:12 -0800
Subject: [PATCH] hugetlb: release pages in the error path of hugetlb_cow()

commit ea4039a34c4c206d015d34a49d0b00868e37db1d upstream.

If we fail to prepare an anon_vma, the {new, old}_page should be released,
or they will leak.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <jweiner@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 mm/hugetlb.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index bfcf153..2b57cd9 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2415,6 +2415,8 @@ retry_avoidcopy:
 	 * anon_vma prepared.
 	 */
 	if (unlikely(anon_vma_prepare(vma))) {
+		page_cache_release(new_page);
+		page_cache_release(old_page);
 		/* Caller expects lock to be held */
 		spin_lock(&mm->page_table_lock);
 		return VM_FAULT_OOM;
-- 
1.7.7.3


-- 
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic

  parent reply	other threads:[~2011-11-28  8:33 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-28 18:22 3.1-rc3-git6: Reported regressions from 3.0 Rafael J. Wysocki
2011-08-28 18:22 ` [Bug #41442] rcu_sched_state detected stall on CPU 0, when booting on Xen Rafael J. Wysocki
2011-08-28 18:30 ` [Bug #41742] duplicate filename for intel_backlight with the i915 driver Rafael J. Wysocki
2011-08-28 18:30 ` [Bug #41502] cfq-iosched: a regression Rafael J. Wysocki
2011-08-28 18:30 ` [Bug #41512] 3.1-rc2 failed s2ram: Freezing of tasks failed after 20.00 seconds Rafael J. Wysocki
2011-08-29  6:30   ` Carlos R. Mafra
2011-08-29 20:38     ` Rafael J. Wysocki
2011-09-02 11:23       ` Carlos R. Mafra
2011-08-28 19:35 ` 3.1-rc3-git6: Reported regressions from 3.0 Dave Jones
2011-08-28 19:39   ` Rafael J. Wysocki
2011-08-28 19:49   ` Linus Torvalds
2011-11-21 21:49 ` 3.2-rc2+: Reported regressions from 3.0 and 3.1 Rafael J. Wysocki
2011-11-21 22:07   ` Linus Torvalds
2011-11-21 22:11   ` Linus Torvalds
2011-11-21 22:34     ` Andy Lutomirski
2011-11-22  7:16       ` Andy Lutomirski
2011-11-21 22:18   ` Linus Torvalds
2011-11-21 22:29     ` Andy Lutomirski
2011-11-28  8:33     ` Michal Hocko [this message]
2011-11-21 22:20   ` Linus Torvalds
2011-11-22  5:27     ` Ari Savolainen
2011-11-21 22:22   ` Linus Torvalds
2011-11-23  7:37     ` Rafał Miłecki
2011-11-21 22:29   ` Alex Deucher
2011-11-22  5:49   ` Srivatsa S. Bhat
2011-11-22  5:59     ` Andrew Morton
2011-11-22 12:22       ` Andrea Arcangeli
2011-11-22 13:54   ` Konrad Rzeszutek Wilk
2011-11-29 18:04     ` Konrad Rzeszutek Wilk
2011-11-29 18:34       ` Borislav Petkov
2011-11-29 20:08         ` Konrad Rzeszutek Wilk
2011-11-30 17:59         ` Konrad Rzeszutek Wilk
2011-12-01 11:39           ` Borislav Petkov
2011-12-01 14:35             ` Konrad Rzeszutek Wilk
     [not found] ` <201112210039.14100.linux-pm-bounces@lists.linux-foundation.org>
2011-12-21  6:45   ` 3.2-rc6+: " Markus Trippelsdorf
2011-12-21  8:18   ` Michel Dänzer
2011-12-21 13:57     ` Alex Deucher

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=20111128083313.GA18337@tiehlicka.suse.cz \
    --to=mhocko@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=florian@mickler.org \
    --cc=kernel-testers@vger.kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=maciej.rutecki@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®