divide error in block2mtd_setup2

Status: upstream: reported C repro on 2026/10/03 20:18
Reported-by: syzbot+d73283781e819fc8a269@syzkaller.appspotmail.com
First crash: 14d, last: 13d
▶ ▼ Similar bugs (3)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 divide error in block2mtd_setup2 origin:lts-only 2 syz, C 50 3d00h 82d 0/3 upstream: reported C repro on 2026/07/28 09:32
linux-6.1 divide error in block2mtd_setup2 2 syz, C 9 12d 14d 0/3 upstream: reported C repro on 2026/10/03 19:16
upstream divide error in block2mtd_setup2 prio:low mtd 2 C 8 18d 69d 26/29 upstream: reported C repro on 2026/08/10 00:34

Sample crash report:
divide error: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 5932 Comm: syz.0.17 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:add_device drivers/mtd/devices/block2mtd.c:291 [inline]
RIP: 0010:block2mtd_setup2+0x57d/0xe30 drivers/mtd/devices/block2mtd.c:454
Code: 37 fc 49 8b 1c 24 48 83 c3 60 48 89 d8 48 c1 e8 03 42 80 3c 28 00 74 08 48 89 df e8 fd 0d 37 fc 48 8b 03 48 63 4c 24 10 48 99 <48> f7 f9 48 89 d3 31 ff 48 89 d6 e8 73 6a de fb 48 85 db 48 8b 5c
RSP: 0018:ffffc900033e7a00 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff88814894c1c0 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 000000000fc00000 RDI: 0000000001f00000
RBP: ffffc900033e7bf8 R08: ffff88802271d45f R09: 1ffff110044e3a8b
R10: dffffc0000000000 R11: ffffed10044e3a8c R12: ffff88814894bb40
R13: dffffc0000000000 R14: ffff88807a8c2000 R15: 1ffff1100f518402
FS:  0000555571a12500(0000) GS:ffff8880b8e00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f91d0870050 CR3: 00000000767d2000 CR4: 00000000003506f0
Call Trace:
 <TASK>
 block2mtd_setup+0x27/0xd0 drivers/mtd/devices/block2mtd.c:471
 param_attr_store+0x20e/0x300 kernel/params.c:586
 module_attr_store+0x5f/0x80 kernel/params.c:906
 kernfs_fop_write_iter+0x3a4/0x520 fs/kernfs/file.c:352
 call_write_iter include/linux/fs.h:2018 [inline]
 new_sync_write fs/read_write.c:491 [inline]
 vfs_write+0x474/0x9a0 fs/read_write.c:584
 ksys_write+0x151/0x260 fs/read_write.c:637
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f91d099e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc3b6a20f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f91d0c25fa0 RCX: 00007f91d099e159
RDX: 00000000000000b3 RSI: 0000200000000250 RDI: 0000000000000003
RBP: 00007f91d0a3506b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f91d0c25fac R14: 00007f91d0c25fa0 R15: 00007f91d0c25fa0
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:add_device drivers/mtd/devices/block2mtd.c:291 [inline]
RIP: 0010:block2mtd_setup2+0x57d/0xe30 drivers/mtd/devices/block2mtd.c:454
Code: 37 fc 49 8b 1c 24 48 83 c3 60 48 89 d8 48 c1 e8 03 42 80 3c 28 00 74 08 48 89 df e8 fd 0d 37 fc 48 8b 03 48 63 4c 24 10 48 99 <48> f7 f9 48 89 d3 31 ff 48 89 d6 e8 73 6a de fb 48 85 db 48 8b 5c
RSP: 0018:ffffc900033e7a00 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff88814894c1c0 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 000000000fc00000 RDI: 0000000001f00000
RBP: ffffc900033e7bf8 R08: ffff88802271d45f R09: 1ffff110044e3a8b
R10: dffffc0000000000 R11: ffffed10044e3a8c R12: ffff88814894bb40
R13: dffffc0000000000 R14: ffff88807a8c2000 R15: 1ffff1100f518402
FS:  0000555571a12500(0000) GS:ffff8880b8e00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f91d0870050 CR3: 00000000767d2000 CR4: 00000000003506f0
----------------
Code disassembly (best guess), 1 bytes skipped:
   0:	fc                   	cld
   1:	49 8b 1c 24          	mov    (%r12),%rbx
   5:	48 83 c3 60          	add    $0x60,%rbx
   9:	48 89 d8             	mov    %rbx,%rax
   c:	48 c1 e8 03          	shr    $0x3,%rax
  10:	42 80 3c 28 00       	cmpb   $0x0,(%rax,%r13,1)
  15:	74 08                	je     0x1f
  17:	48 89 df             	mov    %rbx,%rdi
  1a:	e8 fd 0d 37 fc       	call   0xfc370e1c
  1f:	48 8b 03             	mov    (%rbx),%rax
  22:	48 63 4c 24 10       	movslq 0x10(%rsp),%rcx
  27:	48 99                	cqto
* 29:	48 f7 f9             	idiv   %rcx <-- trapping instruction
  2c:	48 89 d3             	mov    %rdx,%rbx
  2f:	31 ff                	xor    %edi,%edi
  31:	48 89 d6             	mov    %rdx,%rsi
  34:	e8 73 6a de fb       	call   0xfbde6aac
  39:	48 85 db             	test   %rbx,%rbx
  3c:	48                   	rex.W
  3d:	8b                   	.byte 0x8b
  3e:	5c                   	pop    %rsp

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/10/04 09:41 linux-6.6.y a91a6aa9253c 57bbd979 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan divide error in block2mtd_setup2
2026/10/05 07:21 linux-6.6.y a91a6aa9253c 57bbd979 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan divide error in block2mtd_setup2
2026/10/05 07:18 linux-6.6.y a91a6aa9253c 57bbd979 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan divide error in block2mtd_setup2
2026/10/04 21:23 linux-6.6.y a91a6aa9253c 57bbd979 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan divide error in block2mtd_setup2
2026/10/04 21:22 linux-6.6.y a91a6aa9253c 57bbd979 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan divide error in block2mtd_setup2
2026/10/03 20:17 linux-6.6.y a91a6aa9253c 57bbd979 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan divide error in block2mtd_setup2
2026/10/03 20:17 linux-6.6.y a91a6aa9253c 57bbd979 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan divide error in block2mtd_setup2
* Struck through repros no longer work on HEAD.