linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chengguang Xu <cgxu519@mykernel.net>
To: axboe@kernel.dk
Cc: linux-block@vger.kernel.org, Chengguang Xu <cgxu519@mykernel.net>
Subject: [PATCH] block: always set bslab->slab to NULL when creating new slab
Date: Wed, 14 Oct 2020 16:36:08 +0800	[thread overview]
Message-ID: <20201014083608.310098-1-cgxu519@mykernel.net> (raw)

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


                 reply	other threads:[~2020-10-14  8:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201014083608.310098-1-cgxu519@mykernel.net \
    --to=cgxu519@mykernel.net \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).