mm, slub: fix uninitialized variable in __slab_free
Subsystems (2)
PATCH 1/1 mm, slub: fix uninitialized variable in __slab_free
new.frozen is not initialized before it is used.
Fixes 2cfb7455d223 ("slub: Rework allocator fastpaths")
Signed-off-by Chen Jun <[email protected]>
--- mm/slub.c | 1 + 1 file changed, 1 insertion(+)
mm/slub.c +1 -0
@@ -3593,6 +3593,7 @@ static void __slab_free(struct kmem_cache *s, struct slab *slab,return ; } + new.frozen =0 ; do { if (unlikely(n)) { spin_unlock_irqrestore(&n->list_lock, flags);
Signature · 1 line
2.17.1
Quoted 22 lines · Chen Jun
new.frozen is not initialized before it is used.
Fixes 2cfb7455d223 ("slub: Rework allocator fastpaths")Signed-off-by Chen Jun <[email protected]>--- mm/slub.c | 1 + 1 file changed, 1 insertion(+)mm/slub.c +1
-0@@ -3593,6 +3593,7 @@ static void __slab_free(struct kmem_cache *s, struct slab *slab,return ; } + new.frozen =0 ; do { if (unlikely(n)) { spin_unlock_irqrestore(&n->list_lock, flags);Signature · 1 line
2.17.1
This is incorrect because new.frozen is initialized when new.counters is initialized.
See definition of struct slab in mm/slab.h:
struct slab {
[...]
union {
unsigned long counters;
struct {
unsigned inuse:16;
unsigned objects:15;
unsigned frozen:1;
};
};
}Signature · 2 lines
Thanks, Hyeonggon