Mass Storage Function, version: 2009/09/11 LUN: removable file: (no medium) Oops: general protection fault, probably for non-canonical address 0xdffffc0000000002: 0000 [#1] SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017] CPU: 0 UID: 0 PID: 5319 Comm: syz.0.0 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 RIP: 0010:fsg_common_set_num_buffers+0x61/0x2c0 drivers/usb/gadget/function/f_mass_storage.c:2763 Code: ab 01 00 00 49 89 c6 49 bd 00 00 00 00 00 fc ff df bf 00 40 00 00 be c0 0c 00 00 e8 49 5d 64 fa 48 89 c3 4c 89 f0 48 c1 e8 03 <42> 80 3c 28 00 74 08 4c 89 f7 e8 40 2b 70 fa 49 89 1e 48 85 db 0f RSP: 0018:ffffc9000f40fb50 EFLAGS: 00010202 RAX: 0000000000000002 RBX: ffff888050dc4000 RCX: 0000000080000001 RDX: 0000000000004000 RSI: ffffffff8c4bce60 RDI: ffffffff8c4bce20 RBP: ffffc9000f40fc48 R08: 0000000000000cc0 R09: 00000000ffffffff R10: ffffed100a1b9000 R11: ffffffff8eb59c60 R12: 0000000000000000 R13: dffffc0000000000 R14: 0000000000000010 R15: ffff88801fcdc000 FS: 00007fc486c1f6c0(0000) GS:ffff88808c54a000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fc48601be00 CR3: 000000004090b000 CR4: 0000000000352ef0 Call Trace: fsg_opts_num_buffers_store+0x13d/0x1c0 drivers/usb/gadget/function/f_mass_storage.c:3452 flush_write_buffer fs/configfs/file.c:207 [inline] configfs_write_iter+0x337/0x430 fs/configfs/file.c:229 new_sync_write fs/read_write.c:595 [inline] vfs_write+0x612/0xba0 fs/read_write.c:687 ksys_write+0x150/0x270 fs/read_write.c:739 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fc485d9e0d9 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:00007fc486c1efe8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007fc486025fa0 RCX: 00007fc485d9e0d9 RDX: 0000000000000010 RSI: 0000200000000400 RDI: 0000000000000003 RBP: 00007fc485e35024 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fc486026038 R14: 00007fc486025fa0 R15: 00007ffde0f80518 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:fsg_common_set_num_buffers+0x61/0x2c0 drivers/usb/gadget/function/f_mass_storage.c:2763 Code: ab 01 00 00 49 89 c6 49 bd 00 00 00 00 00 fc ff df bf 00 40 00 00 be c0 0c 00 00 e8 49 5d 64 fa 48 89 c3 4c 89 f0 48 c1 e8 03 <42> 80 3c 28 00 74 08 4c 89 f7 e8 40 2b 70 fa 49 89 1e 48 85 db 0f RSP: 0018:ffffc9000f40fb50 EFLAGS: 00010202 RAX: 0000000000000002 RBX: ffff888050dc4000 RCX: 0000000080000001 RDX: 0000000000004000 RSI: ffffffff8c4bce60 RDI: ffffffff8c4bce20 RBP: ffffc9000f40fc48 R08: 0000000000000cc0 R09: 00000000ffffffff R10: ffffed100a1b9000 R11: ffffffff8eb59c60 R12: 0000000000000000 R13: dffffc0000000000 R14: 0000000000000010 R15: ffff88801fcdc000 FS: 00007fc486c1f6c0(0000) GS:ffff88808c54a000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fc486c28230 CR3: 000000004090b000 CR4: 0000000000352ef0 ---------------- Code disassembly (best guess), 2 bytes skipped: 0: 00 00 add %al,(%rax) 2: 49 89 c6 mov %rax,%r14 5: 49 bd 00 00 00 00 00 movabs $0xdffffc0000000000,%r13 c: fc ff df f: bf 00 40 00 00 mov $0x4000,%edi 14: be c0 0c 00 00 mov $0xcc0,%esi 19: e8 49 5d 64 fa call 0xfa645d67 1e: 48 89 c3 mov %rax,%rbx 21: 4c 89 f0 mov %r14,%rax 24: 48 c1 e8 03 shr $0x3,%rax * 28: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1) <-- trapping instruction 2d: 74 08 je 0x37 2f: 4c 89 f7 mov %r14,%rdi 32: e8 40 2b 70 fa call 0xfa702b77 37: 49 89 1e mov %rbx,(%r14) 3a: 48 85 db test %rbx,%rbx 3d: 0f .byte 0xf