Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] block: always set bslab->slab to NULL when creating new slab
@ 2020-10-14  8:36 Chengguang Xu
  0 siblings, 0 replies; only message in thread
From: Chengguang Xu @ 2020-10-14  8:36 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, Chengguang Xu

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.

Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
 block/bio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/bio.c b/block/bio.c
index 640d0fb74a8b..01ece8dbfc7f 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -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)
-- 
2.18.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14  8:36 [PATCH] block: always set bslab->slab to NULL when creating new slab Chengguang Xu

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org
	public-inbox-index linux-block

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git