linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* block: zero logical block size leads to infinite loop in set_init_blocksize()
@ 2026-09-03 17:41 Maks
  2026-09-03 17:55 ` Keith Busch
  0 siblings, 1 reply; 5+ messages in thread
From: Maks @ 2026-09-03 17:41 UTC (permalink / raw)
  To: linux-block; +Cc: Jens Axboe

Hi,

I hit a soft lockup in set_init_blocksize() with a block device whose
logical_block_size was zero.

I understand that logical_block_size == 0 violates the block layer
contract and that the driver which allowed this value needs to be fixed.

However, the generic block code currently turns this invariant violation
into a non-terminating loop:

while (bsize < PAGE_SIZE) {
    if (size & bsize)
        break;
    bsize <<= 1;
}

With bsize == 0, the value never changes.

In my case this resulted in:

watchdog: BUG: soft lockup - CPU#0 stuck for 26s! [(udev-worker):...]
RIP: set_init_blocksize+0x28/0x60

Call Trace:
  blkdev_get_whole+...
  bdev_open+...

Is this considered acceptable behavior for a broken driver, or should
the generic block layer defensively detect this case and fail the open
instead of spinning indefinitely?

If adding such a check is considered worthwhile, I can prepare a patch.

Thanks,
Maks

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

end of thread, other threads:[~2026-09-09 19:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-03 17:41 block: zero logical block size leads to infinite loop in set_init_blocksize() Maks
2026-09-03 17:55 ` Keith Busch
2026-09-03 18:50   ` Maksim Ivanov
2026-09-09 19:11   ` Maks
2026-09-09 19:51     ` Keith Busch

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).