memory leak in iget_locked

From: syzbot
Date: Mon Feb 22 2021 - 04:11:41 EST


Hello,

syzbot found the following issue on:

HEAD commit: f40ddce8 Linux 5.11
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=11e1a434d00000
kernel config: https://syzkaller.appspot.com/x/.config?x=5528e8db7fc481ae
dashboard link: https://syzkaller.appspot.com/bug?extid=739e5b9d4646ff8618a9
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=10aeddd2d00000

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

BUG: memory leak
unreferenced object 0xffff88810ffd32e0 (size 608):
comm "systemd", pid 1, jiffies 4294966945 (age 26.710s)
hex dump (first 32 bytes):
80 80 0c 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
backtrace:
[<00000000159405a6>] alloc_inode+0xbe/0x100 fs/inode.c:235
[<00000000a1ba61ba>] iget_locked+0x126/0x340 fs/inode.c:1192
[<0000000058bf69d6>] kernfs_get_inode+0x20/0x190 fs/kernfs/inode.c:252
[<0000000038d3c844>] kernfs_iop_lookup+0xa0/0xe0 fs/kernfs/dir.c:1100
[<00000000f316b4af>] lookup_open fs/namei.c:3085 [inline]
[<00000000f316b4af>] open_last_lookups fs/namei.c:3180 [inline]
[<00000000f316b4af>] path_openat+0x95d/0x1b00 fs/namei.c:3368
[<00000000952158a9>] do_filp_open+0xa0/0x190 fs/namei.c:3398
[<00000000ca8d298d>] do_sys_openat2+0xed/0x230 fs/open.c:1172
[<00000000be6807df>] do_sys_open fs/open.c:1188 [inline]
[<00000000be6807df>] __do_sys_open fs/open.c:1196 [inline]
[<00000000be6807df>] __se_sys_open fs/open.c:1192 [inline]
[<00000000be6807df>] __x64_sys_open+0x7d/0xe0 fs/open.c:1192
[<00000000ea2012e0>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
[<00000000e7253572>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

BUG: memory leak
unreferenced object 0xffff888111bd1ab0 (size 24):
comm "systemd", pid 1, jiffies 4294966945 (age 26.710s)
hex dump (first 24 bytes):
18 34 fd 0f 81 88 ff ff 90 e3 09 82 ff ff ff ff .4..............
00 00 00 00 00 00 00 00 ........
backtrace:
[<00000000c34be1ab>] kmem_cache_zalloc include/linux/slab.h:672 [inline]
[<00000000c34be1ab>] lsm_inode_alloc security/security.c:590 [inline]
[<00000000c34be1ab>] security_inode_alloc+0x2a/0xb0 security/security.c:973
[<00000000682cda2f>] inode_init_always+0x10c/0x250 fs/inode.c:170
[<00000000b63896fb>] alloc_inode+0x44/0x100 fs/inode.c:240
[<00000000a1ba61ba>] iget_locked+0x126/0x340 fs/inode.c:1192
[<0000000058bf69d6>] kernfs_get_inode+0x20/0x190 fs/kernfs/inode.c:252
[<0000000038d3c844>] kernfs_iop_lookup+0xa0/0xe0 fs/kernfs/dir.c:1100
[<00000000f316b4af>] lookup_open fs/namei.c:3085 [inline]
[<00000000f316b4af>] open_last_lookups fs/namei.c:3180 [inline]
[<00000000f316b4af>] path_openat+0x95d/0x1b00 fs/namei.c:3368
[<00000000952158a9>] do_filp_open+0xa0/0x190 fs/namei.c:3398
[<00000000ca8d298d>] do_sys_openat2+0xed/0x230 fs/open.c:1172
[<00000000be6807df>] do_sys_open fs/open.c:1188 [inline]
[<00000000be6807df>] __do_sys_open fs/open.c:1196 [inline]
[<00000000be6807df>] __se_sys_open fs/open.c:1192 [inline]
[<00000000be6807df>] __x64_sys_open+0x7d/0xe0 fs/open.c:1192
[<00000000ea2012e0>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
[<00000000e7253572>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

BUG: memory leak
unreferenced object 0xffff88810ffd8ce0 (size 608):
comm "systemd", pid 1, jiffies 4294966945 (age 26.710s)
hex dump (first 32 bytes):
a4 81 0c 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
backtrace:
[<00000000159405a6>] alloc_inode+0xbe/0x100 fs/inode.c:235
[<00000000a1ba61ba>] iget_locked+0x126/0x340 fs/inode.c:1192
[<0000000058bf69d6>] kernfs_get_inode+0x20/0x190 fs/kernfs/inode.c:252
[<0000000038d3c844>] kernfs_iop_lookup+0xa0/0xe0 fs/kernfs/dir.c:1100
[<00000000f316b4af>] lookup_open fs/namei.c:3085 [inline]
[<00000000f316b4af>] open_last_lookups fs/namei.c:3180 [inline]
[<00000000f316b4af>] path_openat+0x95d/0x1b00 fs/namei.c:3368
[<00000000952158a9>] do_filp_open+0xa0/0x190 fs/namei.c:3398
[<00000000ca8d298d>] do_sys_openat2+0xed/0x230 fs/open.c:1172
[<00000000be6807df>] do_sys_open fs/open.c:1188 [inline]
[<00000000be6807df>] __do_sys_open fs/open.c:1196 [inline]
[<00000000be6807df>] __se_sys_open fs/open.c:1192 [inline]
[<00000000be6807df>] __x64_sys_open+0x7d/0xe0 fs/open.c:1192
[<00000000ea2012e0>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
[<00000000e7253572>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

BUG: memory leak
unreferenced object 0xffff88810ed17e28 (size 24):
comm "systemd", pid 1, jiffies 4294966945 (age 26.710s)
hex dump (first 24 bytes):
18 8e fd 0f 81 88 ff ff 90 e3 09 82 ff ff ff ff ................
00 00 00 00 00 00 00 00 ........
backtrace:
[<00000000c34be1ab>] kmem_cache_zalloc include/linux/slab.h:672 [inline]
[<00000000c34be1ab>] lsm_inode_alloc security/security.c:590 [inline]
[<00000000c34be1ab>] security_inode_alloc+0x2a/0xb0 security/security.c:973
[<00000000682cda2f>] inode_init_always+0x10c/0x250 fs/inode.c:170
[<00000000b63896fb>] alloc_inode+0x44/0x100 fs/inode.c:240
[<00000000a1ba61ba>] iget_locked+0x126/0x340 fs/inode.c:1192
[<0000000058bf69d6>] kernfs_get_inode+0x20/0x190 fs/kernfs/inode.c:252
[<0000000038d3c844>] kernfs_iop_lookup+0xa0/0xe0 fs/kernfs/dir.c:1100
[<00000000f316b4af>] lookup_open fs/namei.c:3085 [inline]
[<00000000f316b4af>] open_last_lookups fs/namei.c:3180 [inline]
[<00000000f316b4af>] path_openat+0x95d/0x1b00 fs/namei.c:3368
[<00000000952158a9>] do_filp_open+0xa0/0x190 fs/namei.c:3398
[<00000000ca8d298d>] do_sys_openat2+0xed/0x230 fs/open.c:1172
[<00000000be6807df>] do_sys_open fs/open.c:1188 [inline]
[<00000000be6807df>] __do_sys_open fs/open.c:1196 [inline]
[<00000000be6807df>] __se_sys_open fs/open.c:1192 [inline]
[<00000000be6807df>] __x64_sys_open+0x7d/0xe0 fs/open.c:1192
[<00000000ea2012e0>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
[<00000000e7253572>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

[ 323.608401][


---
This report 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@xxxxxxxxxxxxxxxx.

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