Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'slab-for-7.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab

Pull slab fixes from Vlastimil Babka:

- Fix for a memory leak that can occur when already so low on memory
that we can't allocate a new slab anymore (Qing Wang)

- Fix for a case where slabobj_ext array for a slab might be allocated
from the same slab, making it permanently non-freeable (Harry Yoo)

* tag 'slab-for-7.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab:
slab: fix memory leak when refill_sheaf() fails
mm/slab: fix an incorrect check in obj_exts_alloc_size()

+4 -7
+4 -7
mm/slub.c
··· 2119 2119 size_t sz = sizeof(struct slabobj_ext) * slab->objects; 2120 2120 struct kmem_cache *obj_exts_cache; 2121 2121 2122 - /* 2123 - * slabobj_ext array for KMALLOC_CGROUP allocations 2124 - * are served from KMALLOC_NORMAL caches. 2125 - */ 2126 - if (!mem_alloc_profiling_enabled()) 2127 - return sz; 2128 - 2129 2122 if (sz > KMALLOC_MAX_CACHE_SIZE) 2130 2123 return sz; 2131 2124 ··· 2790 2797 if (s->flags & SLAB_KMALLOC) 2791 2798 mark_obj_codetag_empty(sheaf); 2792 2799 2800 + VM_WARN_ON_ONCE(sheaf->size > 0); 2793 2801 kfree(sheaf); 2794 2802 2795 2803 stat(s, SHEAF_FREE); ··· 2822 2828 return 0; 2823 2829 } 2824 2830 2831 + static void sheaf_flush_unused(struct kmem_cache *s, struct slab_sheaf *sheaf); 2825 2832 2826 2833 static struct slab_sheaf *alloc_full_sheaf(struct kmem_cache *s, gfp_t gfp) 2827 2834 { ··· 2832 2837 return NULL; 2833 2838 2834 2839 if (refill_sheaf(s, sheaf, gfp | __GFP_NOMEMALLOC | __GFP_NOWARN)) { 2840 + sheaf_flush_unused(s, sheaf); 2835 2841 free_empty_sheaf(s, sheaf); 2836 2842 return NULL; 2837 2843 } ··· 4619 4623 * we must be very low on memory so don't bother 4620 4624 * with the barn 4621 4625 */ 4626 + sheaf_flush_unused(s, empty); 4622 4627 free_empty_sheaf(s, empty); 4623 4628 } 4624 4629 } else {