Linux block layer
 help / color / mirror / Atom feed
* [PATCH 0/2] fix sbitmap initialization and null_blk tagset setup
@ 2025-07-20 11:35 Nilay Shroff
  2025-07-20 11:35 ` [PATCH 1/2] lib/sbitmap: fix kernel crash observed when sbitmap depth is zero Nilay Shroff
  2025-07-20 11:35 ` [PATCH 2/2] null_blk: fix set->driver_data while setting up tagset Nilay Shroff
  0 siblings, 2 replies; 8+ messages in thread
From: Nilay Shroff @ 2025-07-20 11:35 UTC (permalink / raw)
  To: linux-block
  Cc: hch, ming.lei, hare, axboe, dlemoal, johannes.thumshirn, gjoyce

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 fixes a bug in the null_blk driver where
the driver_data field of the tagset is not properly initialized when 
setting up shared tagsets. This omission causes null_map_queues() to fail
during nr_hw_queues update, leading to no software queues (ctx) being 
mapped to new hardware queues (hctx). As a result, the affected hctx 
remains unused for any IO. Interestingly, this bug exposed the first 
issue with sbitmap freeing.

As usual, review and feedback are most welcome!

Nilay Shroff (2):
  lib/sbitmap: fix kernel crash observed when sbitmap depth is zero
  null_blk: fix set->driver_data while setting up tagset

 drivers/block/null_blk/main.c | 3 ++-
 lib/sbitmap.c                 | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

-- 
2.50.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-07-21 13:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-20 11:35 [PATCH 0/2] fix sbitmap initialization and null_blk tagset setup Nilay Shroff
2025-07-20 11:35 ` [PATCH 1/2] lib/sbitmap: fix kernel crash observed when sbitmap depth is zero Nilay Shroff
2025-07-21  7:15   ` Hannes Reinecke
2025-07-21 13:02   ` Damien Le Moal
2025-07-20 11:35 ` [PATCH 2/2] null_blk: fix set->driver_data while setting up tagset Nilay Shroff
2025-07-21  7:16   ` Hannes Reinecke
2025-07-21 13:04   ` Damien Le Moal
2025-07-21 13:37     ` Nilay Shroff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox