syzbot


memory leak in btrfs_add_delayed_tree_ref

Status: fixed on 2024/01/20 21:18
Subsystems: btrfs
[Documentation on labels]
Reported-by: syzbot+d3ddc6dcc6386dea398b@syzkaller.appspotmail.com
Fix commit: 609d99379736 btrfs: fix qgroup record leaks when using simple quotas
First crash: 398d, last: 390d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [btrfs?] memory leak in btrfs_add_delayed_tree_ref 1 (2) 2023/11/06 20:19

Sample crash report:
executing program
BUG: memory leak
unreferenced object 0xffff88810f56ca40 (size 64):
  comm "kworker/u4:9", pid 2844, jiffies 4294943036 (age 12.910s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 20 52 00 00 00 00 00  ......... R.....
  backtrace:
    [<ffffffff8163353d>] kmemleak_alloc_recursive include/linux/kmemleak.h:42 [inline]
    [<ffffffff8163353d>] slab_post_alloc_hook mm/slab.h:766 [inline]
    [<ffffffff8163353d>] slab_alloc_node mm/slub.c:3478 [inline]
    [<ffffffff8163353d>] __kmem_cache_alloc_node+0x2dd/0x3f0 mm/slub.c:3517
    [<ffffffff8157e395>] kmalloc_trace+0x25/0x90 mm/slab_common.c:1098
    [<ffffffff821382b0>] kmalloc include/linux/slab.h:600 [inline]
    [<ffffffff821382b0>] kzalloc include/linux/slab.h:721 [inline]
    [<ffffffff821382b0>] btrfs_add_delayed_tree_ref+0x550/0x5b0 fs/btrfs/delayed-ref.c:1045
    [<ffffffff8208a2eb>] btrfs_alloc_tree_block+0x65b/0x7c0 fs/btrfs/extent-tree.c:5153
    [<ffffffff8206ef8e>] btrfs_force_cow_block+0x1be/0xb30 fs/btrfs/ctree.c:563
    [<ffffffff8206fa28>] btrfs_cow_block+0x128/0x3b0 fs/btrfs/ctree.c:741
    [<ffffffff82076439>] btrfs_search_slot+0xa49/0x1770 fs/btrfs/ctree.c:2095
    [<ffffffff820900cc>] btrfs_lookup_file_extent+0x7c/0xa0 fs/btrfs/file-item.c:270
    [<ffffffff820ca3fa>] btrfs_drop_extents+0x1aa/0x1670 fs/btrfs/file.c:251
    [<ffffffff820ae42d>] insert_reserved_file_extent+0x10d/0x480 fs/btrfs/inode.c:2898
    [<ffffffff820b6947>] insert_ordered_extent_file_extent fs/btrfs/inode.c:3005 [inline]
    [<ffffffff820b6947>] btrfs_finish_one_ordered+0x957/0xf00 fs/btrfs/inode.c:3113
    [<ffffffff82106858>] btrfs_work_helper+0x158/0x550 fs/btrfs/async-thread.c:315
    [<ffffffff812cb50d>] process_one_work+0x23d/0x530 kernel/workqueue.c:2630
    [<ffffffff812cc137>] process_scheduled_works kernel/workqueue.c:2703 [inline]
    [<ffffffff812cc137>] worker_thread+0x327/0x590 kernel/workqueue.c:2784
    [<ffffffff812d8afb>] kthread+0x12b/0x170 kernel/kthread.c:388
    [<ffffffff8114b9a5>] ret_from_fork+0x45/0x50 arch/x86/kernel/process.c:147

BUG: memory leak
unreferenced object 0xffff88810f56ca80 (size 64):
  comm "kworker/u4:9", pid 2844, jiffies 4294943036 (age 12.910s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 69 00 00 00 00 00  ..........i.....
  backtrace:
    [<ffffffff8163353d>] kmemleak_alloc_recursive include/linux/kmemleak.h:42 [inline]
    [<ffffffff8163353d>] slab_post_alloc_hook mm/slab.h:766 [inline]
    [<ffffffff8163353d>] slab_alloc_node mm/slub.c:3478 [inline]
    [<ffffffff8163353d>] __kmem_cache_alloc_node+0x2dd/0x3f0 mm/slub.c:3517
    [<ffffffff8157e395>] kmalloc_trace+0x25/0x90 mm/slab_common.c:1098
    [<ffffffff821382b0>] kmalloc include/linux/slab.h:600 [inline]
    [<ffffffff821382b0>] kzalloc include/linux/slab.h:721 [inline]
    [<ffffffff821382b0>] btrfs_add_delayed_tree_ref+0x550/0x5b0 fs/btrfs/delayed-ref.c:1045
    [<ffffffff82086db1>] btrfs_free_tree_block+0x131/0x450 fs/btrfs/extent-tree.c:3432
    [<ffffffff8206f4a8>] btrfs_force_cow_block+0x6d8/0xb30 fs/btrfs/ctree.c:618
    [<ffffffff8206fa28>] btrfs_cow_block+0x128/0x3b0 fs/btrfs/ctree.c:741
    [<ffffffff82076439>] btrfs_search_slot+0xa49/0x1770 fs/btrfs/ctree.c:2095
    [<ffffffff820900cc>] btrfs_lookup_file_extent+0x7c/0xa0 fs/btrfs/file-item.c:270
    [<ffffffff820ca3fa>] btrfs_drop_extents+0x1aa/0x1670 fs/btrfs/file.c:251
    [<ffffffff820ae42d>] insert_reserved_file_extent+0x10d/0x480 fs/btrfs/inode.c:2898
    [<ffffffff820b6947>] insert_ordered_extent_file_extent fs/btrfs/inode.c:3005 [inline]
    [<ffffffff820b6947>] btrfs_finish_one_ordered+0x957/0xf00 fs/btrfs/inode.c:3113
    [<ffffffff82106858>] btrfs_work_helper+0x158/0x550 fs/btrfs/async-thread.c:315
    [<ffffffff812cb50d>] process_one_work+0x23d/0x530 kernel/workqueue.c:2630
    [<ffffffff812cc137>] process_scheduled_works kernel/workqueue.c:2703 [inline]
    [<ffffffff812cc137>] worker_thread+0x327/0x590 kernel/workqueue.c:2784
    [<ffffffff812d8afb>] kthread+0x12b/0x170 kernel/kthread.c:388
    [<ffffffff8114b9a5>] ret_from_fork+0x45/0x50 arch/x86/kernel/process.c:147

BUG: memory leak
unreferenced object 0xffff88810f56cb40 (size 64):
  comm "kworker/u4:9", pid 2844, jiffies 4294943036 (age 12.910s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 30 52 00 00 00 00 00  .........0R.....
  backtrace:
    [<ffffffff8163353d>] kmemleak_alloc_recursive include/linux/kmemleak.h:42 [inline]
    [<ffffffff8163353d>] slab_post_alloc_hook mm/slab.h:766 [inline]
    [<ffffffff8163353d>] slab_alloc_node mm/slub.c:3478 [inline]
    [<ffffffff8163353d>] __kmem_cache_alloc_node+0x2dd/0x3f0 mm/slub.c:3517
    [<ffffffff8157e395>] kmalloc_trace+0x25/0x90 mm/slab_common.c:1098
    [<ffffffff821382b0>] kmalloc include/linux/slab.h:600 [inline]
    [<ffffffff821382b0>] kzalloc include/linux/slab.h:721 [inline]
    [<ffffffff821382b0>] btrfs_add_delayed_tree_ref+0x550/0x5b0 fs/btrfs/delayed-ref.c:1045
    [<ffffffff8208a2eb>] btrfs_alloc_tree_block+0x65b/0x7c0 fs/btrfs/extent-tree.c:5153
    [<ffffffff8206ef8e>] btrfs_force_cow_block+0x1be/0xb30 fs/btrfs/ctree.c:563
    [<ffffffff8206fa28>] btrfs_cow_block+0x128/0x3b0 fs/btrfs/ctree.c:741
    [<ffffffff82076439>] btrfs_search_slot+0xa49/0x1770 fs/btrfs/ctree.c:2095
    [<ffffffff820900cc>] btrfs_lookup_file_extent+0x7c/0xa0 fs/btrfs/file-item.c:270
    [<ffffffff820ca3fa>] btrfs_drop_extents+0x1aa/0x1670 fs/btrfs/file.c:251
    [<ffffffff820ae42d>] insert_reserved_file_extent+0x10d/0x480 fs/btrfs/inode.c:2898
    [<ffffffff820b6947>] insert_ordered_extent_file_extent fs/btrfs/inode.c:3005 [inline]
    [<ffffffff820b6947>] btrfs_finish_one_ordered+0x957/0xf00 fs/btrfs/inode.c:3113
    [<ffffffff82106858>] btrfs_work_helper+0x158/0x550 fs/btrfs/async-thread.c:315
    [<ffffffff812cb50d>] process_one_work+0x23d/0x530 kernel/workqueue.c:2630
    [<ffffffff812cc137>] process_scheduled_works kernel/workqueue.c:2703 [inline]
    [<ffffffff812cc137>] worker_thread+0x327/0x590 kernel/workqueue.c:2784
    [<ffffffff812d8afb>] kthread+0x12b/0x170 kernel/kthread.c:388
    [<ffffffff8114b9a5>] ret_from_fork+0x45/0x50 arch/x86/kernel/process.c:147


Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/11/10 20:51 upstream 89cdf9d55601 45e9b83e .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-gce-leak memory leak in btrfs_add_delayed_tree_ref
2023/11/10 16:07 upstream 89cdf9d55601 45e9b83e .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-gce-leak memory leak in btrfs_add_delayed_tree_ref
2023/11/08 09:45 upstream 13d88ac54ddd 83211397 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-gce-leak memory leak in btrfs_add_delayed_tree_ref
2023/11/04 09:09 upstream 8f6f76a6a29f 500bfdc4 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-gce-leak memory leak in btrfs_add_delayed_tree_ref
2023/11/02 17:45 upstream 21e80f3841c0 b5f07fd3 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-gce-leak memory leak in btrfs_add_delayed_tree_ref
2023/11/08 20:06 upstream 305230142ae0 df3908d6 .config console log report syz [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-gce-leak memory leak in btrfs_add_delayed_tree_ref
* Struck through repros no longer work on HEAD.