general protection fault in debugfs_create_files

From: syzbot
Date: Wed Jan 30 2019 - 13:53:07 EST


Hello,

syzbot found the following crash on:

HEAD commit: 02495e76ded5 Add linux-next specific files for 20190130
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=172ed528c00000
kernel config: https://syzkaller.appspot.com/x/.config?x=a2b2e9c0bc43c14d
dashboard link: https://syzkaller.appspot.com/bug?extid=a9d09761be47db706560
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=149209ef400000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13e00c2f400000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+a9d09761be47db706560@xxxxxxxxxxxxxxxxxxxxxxxxx

kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 8264 Comm: syz-executor060 Not tainted 5.0.0-rc4-next-20190130 #22
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:debugfs_create_files+0x2e/0x140 block/blk-mq-debugfs.c:842
Code: 41 56 49 89 fe 41 55 41 54 49 89 f4 53 48 89 d3 e8 87 d0 f3 fd 49 8d 7e 58 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 e3 00 00 00 48 b8 00 00 00 00 00 fc ff df 4d 8b
RSP: 0018:ffff88809331f868 EFLAGS: 00010203
RAX: dffffc0000000000 RBX: ffffffff8881d400 RCX: ffffffff82d9f665
RDX: 0000000000000008 RSI: ffffffff838e48c9 RDI: 0000000000000047
RBP: ffff88809331f888 R08: ffff8880a0c76400 R09: fffffbfff13024e6
R10: fffffbfff13024e5 R11: ffffffff8981272b R12: ffff888099398ed0
R13: ffff888099398ed0 R14: ffffffffffffffef R15: ffff888099398f98
FS: 0000000001edd880(0000) GS:ffff8880ae700000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f835b5dc6f0 CR3: 00000000a0365000 CR4: 00000000001406e0
Call Trace:
blk_mq_debugfs_register+0xec/0x4e0 block/blk-mq-debugfs.c:865
blk_register_queue+0x1bc/0x370 block/blk-sysfs.c:944
__device_add_disk+0xe9f/0x13c0 block/genhd.c:723
device_add_disk+0x2b/0x40 block/genhd.c:739
add_disk include/linux/genhd.h:422 [inline]
loop_add+0x71d/0xa30 drivers/block/loop.c:1999
loop_control_ioctl+0x18e/0x470 drivers/block/loop.c:2100
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:509 [inline]
do_vfs_ioctl+0x107b/0x17d0 fs/ioctl.c:696
ksys_ioctl+0xab/0xd0 fs/ioctl.c:713
__do_sys_ioctl fs/ioctl.c:720 [inline]
__se_sys_ioctl fs/ioctl.c:718 [inline]
__x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4420d9
Code: e8 6c e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 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 0f 83 cb 09 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffddb7abd48 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00000000004420d9
RDX: 0000000000000000 RSI: 0000000000004c80 RDI: 0000000000000003
RBP: 0000000000010555 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000402f30
R13: 0000000000402fc0 R14: 0000000000000000 R15: 0000000000000000
Modules linked in:
---[ end trace 5909b82e24594aac ]---
RIP: 0010:debugfs_create_files+0x2e/0x140 block/blk-mq-debugfs.c:842
Code: 41 56 49 89 fe 41 55 41 54 49 89 f4 53 48 89 d3 e8 87 d0 f3 fd 49 8d 7e 58 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 e3 00 00 00 48 b8 00 00 00 00 00 fc ff df 4d 8b
RSP: 0018:ffff88809331f868 EFLAGS: 00010203
RAX: dffffc0000000000 RBX: ffffffff8881d400 RCX: ffffffff82d9f665
RDX: 0000000000000008 RSI: ffffffff838e48c9 RDI: 0000000000000047
RBP: ffff88809331f888 R08: ffff8880a0c76400 R09: fffffbfff13024e6
R10: fffffbfff13024e5 R11: ffffffff8981272b R12: ffff888099398ed0
R13: ffff888099398ed0 R14: ffffffffffffffef R15: ffff888099398f98
FS: 0000000001edd880(0000) GS:ffff8880ae700000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f835b5dc6f0 CR3: 00000000a0365000 CR4: 00000000001406e0


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxxx

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches