[lkml]   [2017]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH RT] mm/slub: close possible memory-leak in kmem_cache_alloc_bulk()
Under certain circumstances we could leak elements which were moved to
the local "to_free" list. The damage is limited since I can't find any
users here.

Signed-off-by: Sebastian Andrzej Siewior <>
Jesper: There are no users of kmem_cache_alloc_bulk() and kfree_bulk().
Only kmem_cache_free_bulk() is used since it was introduced. Do you
think that it would make sense to remove those?

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

diff --git a/mm/slub.c b/mm/slub.c
index ffd2fa0f415e..9053e929ce9d 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3240,6 +3240,7 @@ int kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size,
return i;
+ free_delayed(&to_free);
slab_post_alloc_hook(s, flags, i, p);
__kmem_cache_free_bulk(s, i, p);
return 0;
 \ /
  Last update: 2017-12-13 15:06    [W:0.048 / U:0.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site