aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2014-02-10 14:25:39 -0800
committerMoyster <oysterized@gmail.com>2016-09-28 15:13:59 +0200
commitc7bb9ef99a42148167253628812f0a15d1b65980 (patch)
tree24ec5a2e120b9dc7c43fe6617faca3a663b042c9
parente32f3f294541254bd5dff81653ddef59ce658577 (diff)
downloadandroid_kernel_m2note-c7bb9ef99a42148167253628812f0a15d1b65980.tar.gz
mm/slub.c: list_lock may not be held in some circumstances
Commit c65c1877bd68 ("slub: use lockdep_assert_held") incorrectly required that add_full() and remove_full() hold n->list_lock. The lock is only taken when kmem_cache_debug(s), since that's the only time it actually does anything. Require that the lock only be taken under such a condition. Reported-by: Larry Finger <Larry.Finger@lwfinger.net> Tested-by: Larry Finger <Larry.Finger@lwfinger.net> Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Acked-by: Christoph Lameter <cl@linux.com> Cc: Pekka Enberg <penberg@kernel.org> Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: W4TCH0UT <ateekujjawal@gmail.com>
-rw-r--r--mm/slub.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/mm/slub.c b/mm/slub.c
index f844c0044..3e2c9d14c 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1123,21 +1123,19 @@ static inline void slab_free_hook(struct kmem_cache *s, void *x)
static void add_full(struct kmem_cache *s,
struct kmem_cache_node *n, struct page *page)
{
- lockdep_assert_held(&n->list_lock);
-
if (!(s->flags & SLAB_STORE_USER))
return;
+ lockdep_assert_held(&n->list_lock);
list_add(&page->lru, &n->full);
}
static void remove_full(struct kmem_cache *s, struct kmem_cache_node *n, struct page *page)
{
- lockdep_assert_held(&n->list_lock);
-
if (!(s->flags & SLAB_STORE_USER))
return;
+ lockdep_assert_held(&n->list_lock);
list_del(&page->lru);
}