This is a note to let you know that I've just added the patch titled

    slub: assign refcount for kmalloc_caches

to the 3.7-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     slub-assign-refcount-for-kmalloc_caches.patch
and it can be found in the queue-3.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From [email protected]  Fri Feb  1 13:47:04 2013
From: CAI Qian <[email protected]>
Date: Thu, 24 Jan 2013 22:50:09 -0500 (EST)
Subject: slub: assign refcount for kmalloc_caches
To: [email protected]
Cc: Christoph Lameter <[email protected]>, Joonsoo Kim <[email protected]>, Paul 
Hargrove <[email protected]>
Message-ID: <[email protected]>

From: CAI Qian <[email protected]>

This is for stable-3.7.y only and this problem has already been solved
in mainline through some slab/slub re-work which isn't suitable to
backport here. See create_kmalloc_cache() in mm/slab_common.c there.

commit cce89f4f6911286500cf7be0363f46c9b0a12ce0('Move kmem_cache
refcounting to common code') moves some refcount manipulation code to
common code. Unfortunately, it also removed refcount assignment for
kmalloc_caches. So, kmalloc_caches's refcount is initially 0.
This makes erroneous situation.

Paul Hargrove report that when he create a 8-byte kmem_cache and
destory it, he encounter below message.
'Objects remaining in kmalloc-8 on kmem_cache_close()'

8-byte kmem_cache merge with 8-byte kmalloc cache and refcount is
increased by one. So, resulting refcount is 1. When destroy it, it hit
refcount = 0, then kmem_cache_close() is executed and error message is
printed.

This patch assign initial refcount 1 to kmalloc_caches, so fix this
erroneous situation.

Reported-by: Paul Hargrove <[email protected]>
Cc: Christoph Lameter <[email protected]>
Signed-off-by: Joonsoo Kim <[email protected]>
Signed-off-by: CAI Qian <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 mm/slub.c |    1 +
 1 file changed, 1 insertion(+)

--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3279,6 +3279,7 @@ static struct kmem_cache *__init create_
        if (kmem_cache_open(s, flags))
                goto panic;
 
+       s->refcount = 1;
        list_add(&s->list, &slab_caches);
        return s;
 


Patches currently in stable-queue which might be from [email protected] are

queue-3.7/target-fix-regression-with-dev_link_magic-in-target_fabric_port_link.patch
queue-3.7/xfs-fix-_xfs_buf_find-oops-on-blocks-beyond-the-filesystem-end.patch
queue-3.7/drm-i915-fix-forcewake-posting-reads.patch
queue-3.7/slub-assign-refcount-for-kmalloc_caches.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to