Skip to contentSkip to conversation

block: always set bslab->slab to NULL when creating new slab

PATCH New Chengguang Xu 1 participant 1 message Oct 14, 2020 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: always set bslab->slab to NULL when creating new slab

When fail to create new slab and if the entry slot is acquired by extending bio_slab_max, bslab->slab will contain uninitialized data and it may affect subsequent search.

---
 block/bio.c | 1 +
 1 file changed, 1 insertion(+)
block/bio.c +1 -0
index 640d0fb74a8b..01ece8dbfc7f 100644
@@ -104,6 +104,7 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size)
 	bslab = &bio_slabs[entry];
 
 	snprintf(bslab->name, sizeof(bslab->name), "bio-%d", entry);
+	bslab->slab = NULL;
 	slab = kmem_cache_create(bslab->name, sz, ARCH_KMALLOC_MINALIGN,
 				 SLAB_HWCACHE_ALIGN, NULL);
 	if (!slab)
Signature · 1 line
2.18.4