The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Jörn Engel" <joern@barelysecure.org>
To: syzbot <syzbot+b320a4d5f65a61dbbf89@syzkaller.appspotmail.com>
Cc: joern@lazybastard.org, linux-kernel@vger.kernel.org,
	linux-mtd@lists.infradead.org, miquel.raynal@bootlin.com,
	richard@nod.at, syzkaller-bugs@googlegroups.com, vigneshr@ti.com
Subject: Re: [syzbot] [mtd?] divide error in block2mtd_setup2
Date: Sun, 9 Aug 2026 19:03:22 -0700	[thread overview]
Message-ID: <ankxaiwtTltL0xMj@cashel.logfs.org> (raw)
In-Reply-To: <6a791c94.01d0871a.3a0d52.009b.GAE@google.com>

On Sun, Aug 09, 2026 at 05:34:28PM -0700, syzbot wrote:
> 
> * 2a:	f7 f6                	div    %esi <-- trapping instruction

Best guess would be this:

	if ((long)size % erase_size) {

Someone passing an erase_size of 0 would indeed trigger an exception.
Fix would be something like this:

-	if ((long)size % erase_size) {
+	if (!erase_size || (long)size % erase_size) {

I haven't touched the code is nearly two decades.  If somebody else
feels like sending a patch and gathering all the glory, please be my
guest!

Jörn

--
Those who come seeking peace without a treaty are plotting.
-- Sun Tzu

  reply	other threads:[~2026-08-10  2:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10  0:34 [syzbot] [mtd?] divide error in block2mtd_setup2 syzbot
2026-08-10  2:03 ` Jörn Engel [this message]
2026-08-10  9:17   ` Pei Xiao
2026-08-10 12:40     ` Miquel Raynal
2026-08-10  9:12 ` [PATCH] mtd: block2mtd: Fix divide error when erase_size is zero Pei Xiao

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=ankxaiwtTltL0xMj@cashel.logfs.org \
    --to=joern@barelysecure.org \
    --cc=joern@lazybastard.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=syzbot+b320a4d5f65a61dbbf89@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=vigneshr@ti.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