Bug 216705

Summary: ubifs: memleak in dirty_cow_znode's error handling path
Product: File System Reporter: Zhihao Cheng (chengzhihao1)
Component: OtherAssignee: fs_other
Status: NEW ---    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 6.1.0-rc5 Subsystem:
Regression: No Bisected commit-id:
Attachments: diff
setup.sh

Description Zhihao Cheng 2022-11-18 08:06:33 UTC
1. Apply diff
2. ./setup.sh 1
3. ./xfstests-dev/ltp/fsstress -d temp -l0 -n 1000 -p 4
4. echo scan > /sys/kernel/debug/kmemleak
5. cat /sys/kernel/debug/kmemleak

unreferenced object 0xffff888173b7a400 (size 1024):
  comm "kworker/u8:7", pid 79, jiffies 4294728150 (age 15.339s)
  hex dump (first 32 bytes):
    00 a8 b7 73 81 88 ff ff 00 00 00 00 00 00 00 00  ...s............
    00 4c 59 7a 81 88 ff ff 01 00 00 00 00 00 00 00  .LYz............
  backtrace:
    [<00000000e21ac054>] slab_post_alloc_hook+0x89/0x5a0
    [<000000009c2262f6>] __kmem_cache_alloc_node+0x1de/0x400
    [<0000000075380dcb>] __kmalloc_node_track_caller+0x5c/0x280
    [<00000000054caf24>] kmemdup+0x32/0x70
    [<000000004e90d9fb>] dirty_cow_znode+0xe7/0x2e0 [ubifs]
    [<0000000078da6869>] lookup_level0_dirty+0xf9/0x550 [ubifs]
    [<000000008f95bcab>] ubifs_tnc_add+0x7f/0x2c0 [ubifs]
    [<000000000216832b>] ubifs_jnl_write_data+0x28f/0x580 [ubifs]
    [<00000000a4b01bf4>] do_writepage+0xbd/0x480 [ubifs]
    [<0000000050992322>] ubifs_writepage+0x1e7/0x3d0 [ubifs]
    [<000000006497a924>] __writepage+0x1c/0xc0
    [<0000000095d2e11a>] write_cache_pages+0x1cc/0x850
    [<00000000a01394db>] generic_writepages+0x5c/0xb0
    [<000000004a2dd4b1>] do_writepages+0xcc/0x200
    [<00000000b0c753e5>] __writeback_single_inode+0x61/0x6c0
    [<00000000583fed20>] writeback_sb_inodes+0x255/0x730
Comment 1 Zhihao Cheng 2022-11-18 08:09:34 UTC
Created attachment 303208 [details]
diff
Comment 2 Zhihao Cheng 2022-11-18 08:09:44 UTC
Created attachment 303209 [details]
setup.sh