From: Nilay Shroff <nilay@linux.ibm.com>
To: linux-block@vger.kernel.org
Cc: hch@lst.de, dlemoal@kernel.org, yukuai1@huaweicloud.com,
hare@suse.de, ming.lei@redhat.com, axboe@kernel.dk,
johannes.thumshirn@wdc.com, gjoyce@ibm.com
Subject: [PATCHv3 0/2] fix sbitmap initialization and null_blk shared tagset behavior
Date: Wed, 23 Jul 2025 19:13:53 +0530 [thread overview]
Message-ID: <20250723134442.1283664-1-nilay@linux.ibm.com> (raw)
Hi,
This patchset fixes two subtle issues discovered while unit testing
nr_hw_queue update code using null_blk driver.
The first patch in the series, fixes an issue in the sbitmap initialization
code, where sb->alloc_hint is not explicitly set to NULL when the sbitmap
depth is zero. This can lead to a kernel crash in sbitmap_free(), which
unconditionally calls free_percpu() on sb->alloc_hint — even if it was
never allocated. The crash is caused by dereferencing an invalid pointer
or stale garbage value.
The second patch in the series, prevents runtime updates to submit_queues
or poll_queues when using a shared tagset. Currently, such updates lead
to the allocation of new hardware queues (hctx) that are never mapped to
any software queues (ctx), rendering them unusable for I/O. This patch
rejects these changes and ensures more consistent behavior. Interestingly,
this unnecessary queue update path helped uncover the issue fixed in first
patch.
As usual, review and feedback are most welcome!
Changes from v2:
- Updated the second patch to prevent the user from modifying submit
or poll queues when tagset is shared (Damien Le Moal, Yu Kuai)
Changes from v1:
- The set->driver_data field should be initialized separately for the
shared tagset to ensure it is correctly set for both shared and
non-shared tagset cases. (Damien Le Moal)
Nilay Shroff (2):
lib/sbitmap: fix kernel crash observed when sbitmap depth is zero
null_blk: prevent submit and poll queues update for shared tagset
drivers/block/null_blk/main.c | 32 ++++++++++++++++++++++----------
lib/sbitmap.c | 1 +
2 files changed, 23 insertions(+), 10 deletions(-)
--
2.50.1
next reply other threads:[~2025-07-23 13:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-23 13:43 Nilay Shroff [this message]
2025-07-23 13:43 ` [PATCHv3 1/2] lib/sbitmap: fix kernel crash observed when sbitmap depth is zero Nilay Shroff
2025-07-24 2:19 ` Yu Kuai
2025-07-23 13:43 ` [PATCHv3 2/2] null_blk: prevent submit and poll queues update for shared tagset Nilay Shroff
2025-07-23 15:29 ` Hannes Reinecke
2025-07-23 23:53 ` Damien Le Moal
2025-07-24 2:21 ` Yu Kuai
2025-10-16 10:43 ` [PATCHv3 0/2] fix sbitmap initialization and null_blk shared tagset behavior Nilay Shroff
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=20250723134442.1283664-1-nilay@linux.ibm.com \
--to=nilay@linux.ibm.com \
--cc=axboe@kernel.dk \
--cc=dlemoal@kernel.org \
--cc=gjoyce@ibm.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=johannes.thumshirn@wdc.com \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=yukuai1@huaweicloud.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.