mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org,
	stable-review@kernel.org
Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org,
	Dave Anderson <anderson@redhat.com>,
	Paul Menage <menage@google.com>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 22/52] cgroups: fix 2.6.32 regression causing BUG_ON() in cgroup_diput()
Date: Thu, 14 Jan 2010 14:27:01 -0800	[thread overview]
Message-ID: <1263508051-7868-22-git-send-email-gregkh@suse.de> (raw)
In-Reply-To: <1263508051-7868-21-git-send-email-gregkh@suse.de>

From: Dave Anderson <anderson@redhat.com>

commit bd4f490a079730aadfaf9a728303ea0135c01945 upstream.

The LTP cgroup test suite generates a "kernel BUG at kernel/cgroup.c:790!"
here in cgroup_diput():

                 /*
                  * if we're getting rid of the cgroup, refcount should ensure
                  * that there are no pidlists left.
                  */
                 BUG_ON(!list_empty(&cgrp->pidlists));

The cgroup pidlist rework in 2.6.32 generates the BUG_ON, which is caused
when pidlist_array_load() calls cgroup_pidlist_find():

(1) if a matching cgroup_pidlist is found, it down_write's the mutex of the
     pre-existing cgroup_pidlist, and increments its use_count.
(2) if no matching cgroup_pidlist is found, then a new one is allocated, it
     down_write's its mutex, and the use_count is set to 0.
(3) the matching, or new, cgroup_pidlist gets returned back to pidlist_array_load(),
     which increments its use_count -- regardless whether new or pre-existing --
     and up_write's the mutex.

So if a matching list is ever encountered by cgroup_pidlist_find() during
the life of a cgroup directory, it results in an inflated use_count value,
preventing it from ever getting released by cgroup_release_pid_array().
Then if the directory is subsequently removed, cgroup_diput() hits the
BUG_ON() when it finds that the directory's cgroup is still populated with
a pidlist.

The patch simply removes the use_count increment when a matching pidlist
is found by cgroup_pidlist_find(), because it gets bumped by the calling
pidlist_array_load() function while still protected by the list's mutex.

Signed-off-by: Dave Anderson <anderson@redhat.com>
Reviewed-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Ben Blum <bblum@andrew.cmu.edu>
Cc: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 kernel/cgroup.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 0249f4b..1fbcc74 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2468,7 +2468,6 @@ static struct cgroup_pidlist *cgroup_pidlist_find(struct cgroup *cgrp,
 			/* make sure l doesn't vanish out from under us */
 			down_write(&l->mutex);
 			mutex_unlock(&cgrp->pidlist_mutex);
-			l->use_count++;
 			return l;
 		}
 	}
-- 
1.6.6


  reply	other threads:[~2010-01-14 22:28 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-14 22:25 [00/52] 2.6.32.4-stable review Greg KH
2010-01-14 22:26 ` [PATCH 01/52] untangle the do_mremap() mess Greg Kroah-Hartman
2010-01-14 22:26   ` [PATCH 02/52] fasync: split 'fasync_helper()' into separate add/remove functions Greg Kroah-Hartman
2010-01-14 22:26     ` [PATCH 03/52] ASoC: fix params_rate() macro use in several codecs Greg Kroah-Hartman
2010-01-14 22:26       ` [PATCH 04/52] modules: Skip empty sections when exporting section notes Greg Kroah-Hartman
2010-01-14 22:26         ` [PATCH 05/52] exofs: simple_write_end does not mark_inode_dirty Greg Kroah-Hartman
2010-01-14 22:26           ` [PATCH 06/52] Revert "x86: Side-step lguest problem by only building cmpxchg8b_emu for pre-Pentium" Greg Kroah-Hartman
2010-01-14 22:26             ` [PATCH 07/52] nfsd: make sure data is on disk before calling ->fsync Greg Kroah-Hartman
2010-01-14 22:26               ` [PATCH 08/52] sunrpc: fix peername failed on closed listener Greg Kroah-Hartman
2010-01-14 22:26                 ` [PATCH 09/52] SUNRPC: Fix up an error return value in gss_import_sec_context_kerberos() Greg Kroah-Hartman
2010-01-14 22:26                   ` [PATCH 10/52] SUNRPC: Fix the return value in gss_import_sec_context() Greg Kroah-Hartman
2010-01-14 22:26                     ` [PATCH 11/52] sunrpc: on successful gss error pipe write, don't return error Greg Kroah-Hartman
2010-01-14 22:26                       ` [PATCH 12/52] drm/i915: Update LVDS connector status when receiving ACPI LID event Greg Kroah-Hartman
2010-01-14 22:26                         ` [PATCH 13/52] drm/i915: fix order of fence release wrt flushing Greg Kroah-Hartman
2010-01-14 22:26                           ` [PATCH 14/52] drm/i915: Permit pinning whilst the device is 'suspended' Greg Kroah-Hartman
2010-01-14 22:26                             ` [PATCH 15/52] drm: remove address mask param for drm_pci_alloc() Greg Kroah-Hartman
2010-01-14 22:26                               ` [PATCH 16/52] drm/i915: Enable/disable the dithering for LVDS based on VBT setting Greg Kroah-Hartman
2010-01-14 22:26                                 ` [PATCH 17/52] drm/i915: Make the BPC in FDI rx/transcoder be consistent with that in pipeconf on Ironlake Greg Kroah-Hartman
2010-01-14 22:26                                   ` [PATCH 18/52] drm/i915: Select the correct BPC for LVDS " Greg Kroah-Hartman
2010-01-14 22:26                                     ` [PATCH 19/52] drm/i915: fix unused var Greg Kroah-Hartman
2010-01-14 22:26                                       ` [PATCH 20/52] rtc_cmos: convert shutdown to new pnp_driver->shutdown Greg Kroah-Hartman
2010-01-14 22:27                                         ` [PATCH 21/52] drivers/cpuidle/governors/menu.c: fix undefined reference to `__udivdi3' Greg Kroah-Hartman
2010-01-14 22:27                                           ` Greg Kroah-Hartman [this message]
2010-01-14 22:27                                             ` [PATCH 23/52] lib/rational.c needs module.h Greg Kroah-Hartman
2010-01-14 22:27                                               ` [PATCH 24/52] dma-debug: allow DMA_BIDIRECTIONAL mappings to be synced with DMA_FROM_DEVICE and Greg Kroah-Hartman
2010-01-14 22:27                                                 ` [PATCH 25/52] kernel/signal.c: fix kernel information leak with print-fatal-signals=1 Greg Kroah-Hartman
2010-01-14 22:27                                                   ` [PATCH 26/52] mmc_block: add dev_t initialization check Greg Kroah-Hartman
2010-01-14 22:27                                                     ` [PATCH 27/52] mmc_block: fix probe error cleanup bug Greg Kroah-Hartman
2010-01-14 22:27                                                       ` [PATCH 28/52] mmc_block: fix queue cleanup Greg Kroah-Hartman
2010-01-14 22:27                                                         ` [PATCH 29/52] ALSA: hda - Fix ALC861-VD capture source mixer Greg Kroah-Hartman
2010-01-14 22:27                                                           ` [PATCH 30/52] ALSA: ac97: Add Dell Dimension 2400 to Headphone/Line Jack Sense blacklist Greg Kroah-Hartman
2010-01-14 22:27                                                             ` [PATCH 31/52] ALSA: atiixp: Specify codec for Foxconn RC4107MA-RS2 Greg Kroah-Hartman
2010-01-14 22:27                                                               ` [PATCH 32/52] ASoC: Fix WM8350 DSP mode B configuration Greg Kroah-Hartman
2010-01-14 22:27                                                                 ` [PATCH 33/52] netfilter: ebtables: enforce CAP_NET_ADMIN Greg Kroah-Hartman
2010-01-14 22:27                                                                   ` [PATCH 34/52] netfilter: nf_ct_ftp: fix out of bounds read in update_nl_seq() Greg Kroah-Hartman
2010-01-14 22:27                                                                     ` [PATCH 35/52] hwmon: (coretemp) Fix TjMax for Atom N450/D410/D510 CPUs Greg Kroah-Hartman
2010-01-14 22:27                                                                       ` [PATCH 36/52] hwmon: (adt7462) Fix pin 28 monitoring Greg Kroah-Hartman
2010-01-14 22:27                                                                         ` [PATCH 37/52] quota: Fix dquot_transfer for filesystems different from ext4 Greg Kroah-Hartman
2010-01-14 22:27                                                                           ` [PATCH 38/52] xen: fix hang on suspend Greg Kroah-Hartman
2010-01-14 22:27                                                                             ` [PATCH 39/52] iwlwifi: fix iwl_queue_used bug when read_ptr == write_ptr Greg Kroah-Hartman
2010-01-14 22:27                                                                               ` [PATCH 40/52] ath5k: Fix eeprom checksum check for custom sized eeproms Greg Kroah-Hartman
2010-01-14 22:27                                                                                 ` [PATCH 41/52] cfg80211: fix syntax error on user regulatory hints Greg Kroah-Hartman
2010-01-14 22:27                                                                                   ` [PATCH 42/52] iwl: off by one bug Greg Kroah-Hartman
2010-01-14 22:27                                                                                     ` [PATCH 43/52] mac80211: add missing sanity checks for action frames Greg Kroah-Hartman
2010-01-14 22:27                                                                                       ` [PATCH 44/52] drm/i915: remove render reclock support Greg Kroah-Hartman
2010-01-14 22:27                                                                                         ` [PATCH 45/52] libertas: Remove carrier signaling from the scan code Greg Kroah-Hartman
2010-01-14 22:27                                                                                           ` [PATCH 46/52] kernel/sysctl.c: fix stable merge error in NOMMU mmap_min_addr Greg Kroah-Hartman
2010-01-14 22:27                                                                                             ` [PATCH 47/52] mac80211: fix skb buffering issue (and fixes to that) Greg Kroah-Hartman
2010-01-14 22:27                                                                                               ` [PATCH 48/52] fix braindamage in audit_tree.c untag_chunk() Greg Kroah-Hartman
2010-01-14 22:27                                                                                                 ` [PATCH 49/52] fix more leaks in audit_tree.c tag_chunk() Greg Kroah-Hartman
2010-01-14 22:27                                                                                                   ` [PATCH 50/52] module: handle ppc64 relocating kcrctabs when CONFIG_RELOCATABLE=y Greg Kroah-Hartman
2010-01-14 22:27                                                                                                     ` [PATCH 51/52] ipv6: skb_dst() can be NULL in ipv6_hop_jumbo() Greg Kroah-Hartman
2010-01-14 22:27                                                                                                       ` [PATCH 52/52] Linux 2.6.32.4-rc1 Greg Kroah-Hartman
2010-01-14 23:38                               ` [Stable-review] [PATCH 15/52] drm: remove address mask param for drm_pci_alloc() Ben Hutchings
2010-01-14 23:45                                 ` Greg KH
2010-01-15  0:56                                   ` Zhenyu Wang
2010-01-16  0:15                                     ` Greg KH

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=1263508051-7868-22-git-send-email-gregkh@suse.de \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=anderson@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=menage@google.com \
    --cc=stable-review@kernel.org \
    --cc=stable@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

Powered by JetHome