From: Christoph Hellwig <hch@infradead.org>
To: tongzhiwei <tongzhiwei@cmss.chinamobile.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
dm-devel@lists.linux.dev, syzkaller-bugs@googlegroups.com,
syzbot+1288484b13bf6af3620d@syzkaller.appspotmail.com
Subject: Re: [PATCH] block: fix divide by zero in queue_limit_discard_alignment()
Date: Fri, 20 Nov 2026 07:24:42 -0800 [thread overview]
Message-ID: <awBmOrGl2dlMEd-q@infradead.org> (raw)
In-Reply-To: <20261120103040.610-1-tongzhiwei@cmss.chinamobile.com>
On Fri, Nov 20, 2026 at 06:30:13PM +0800, tongzhiwei wrote:
> Commit e924da7d6622 ("block: Drop granularity check in
> queue_limit_discard_alignment()") removed the check for a sub-sector
> discard granularity on the assumption that lim->discard_granularity
> is always at least SECTOR_SIZE.
>
> That assumption does not hold for every queue: a backing device can
> report a non-zero discard granularity smaller than 512 bytes. When
> blk_stack_limits() stacks such limits, only the non-zero granularity
> is checked, and queue_limit_discard_alignment() shifts the value down
> to zero and divides by it:
Well, then let's fix the setup time to reject this. Because a discard
granularity less than a sector by definition makes no sense whatsoever.
prev parent reply other threads:[~2026-11-20 15:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 10:30 tongzhiwei
2026-11-20 15:24 ` Christoph Hellwig [this message]
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=awBmOrGl2dlMEd-q@infradead.org \
--to=hch@infradead.org \
--cc=axboe@kernel.dk \
--cc=dm-devel@lists.linux.dev \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+1288484b13bf6af3620d@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=tongzhiwei@cmss.chinamobile.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®