[syzbot] [mtd?] divide error in block2mtd_setup2

Jörn Engel joern at barelysecure.org
Sun Aug 9 19:03:22 PDT 2026


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



More information about the linux-mtd mailing list