All of lore.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [block?] memory leak in null_init_zoned_dev
@ 2026-08-14  0:03 syzbot
  2026-08-14  4:50 ` Edward Adam Davis
  2026-08-14  8:21 ` [PATCH] nullb: free zones when device is power-off Edward Adam Davis
  0 siblings, 2 replies; 4+ messages in thread
From: syzbot @ 2026-08-14  0:03 UTC (permalink / raw)
  To: axboe, linux-block, linux-kernel, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    06cf61899d64 Merge tag 'x86-urgent-2026-08-08' of git://gi..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=146d4149580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=6843f8fd2336602d
dashboard link: https://syzkaller.appspot.com/bug?extid=f57d67a92532a98a562d
compiler:       gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=126d4149580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=11531132580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/e023ff6ad9bc/disk-06cf6189.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ea49527ba5df/vmlinux-06cf6189.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e3d6468d0490/bzImage-06cf6189.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+f57d67a92532a98a562d@syzkaller.appspotmail.com

BUG: memory leak
unreferenced object 0xffff888126990000 (size 56000):
  comm "syz.0.17", pid 5947, jiffies 4294943074
  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 02 00 00 00 01 00 00 00  ................
  backtrace (crc 5c9573f8):
    ___kmalloc_large_node+0xbc/0x100 mm/slub.c:5287
    __kmalloc_large_node_noprof+0x1a/0xb0 mm/slub.c:5305
    __do_kmalloc_node mm/slub.c:5322 [inline]
    __kvmalloc_node_noprof+0x460/0x6f0 mm/slub.c:6905
    null_init_zoned_dev+0x108/0x520 drivers/block/null_blk/zoned.c:94
    null_add_dev+0x8a6/0xae0 drivers/block/null_blk/main.c:1993
    nullb_device_power_store+0xf9/0x1f0 drivers/block/null_blk/main.c:501
    flush_write_buffer fs/configfs/file.c:207 [inline]
    configfs_write_iter+0x10d/0x1a0 fs/configfs/file.c:229
    new_sync_write fs/read_write.c:595 [inline]
    vfs_write+0x3ac/0x720 fs/read_write.c:687
    ksys_write+0xa5/0x170 fs/read_write.c:739
    do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
    do_syscall_64+0xf8/0x610 arch/x86/entry/syscall_64.c:94
    entry_SYSCALL_64_after_hwframe+0x77/0x7f

BUG: memory leak
unreferenced object 0xffff888127f80000 (size 56000):
  comm "syz.0.18", pid 5951, jiffies 4294943093
  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 02 00 00 00 01 00 00 00  ................
  backtrace (crc 5c9573f8):
    ___kmalloc_large_node+0xbc/0x100 mm/slub.c:5287
    __kmalloc_large_node_noprof+0x1a/0xb0 mm/slub.c:5305
    __do_kmalloc_node mm/slub.c:5322 [inline]
    __kvmalloc_node_noprof+0x460/0x6f0 mm/slub.c:6905
    null_init_zoned_dev+0x108/0x520 drivers/block/null_blk/zoned.c:94
    null_add_dev+0x8a6/0xae0 drivers/block/null_blk/main.c:1993
    nullb_device_power_store+0xf9/0x1f0 drivers/block/null_blk/main.c:501
    flush_write_buffer fs/configfs/file.c:207 [inline]
    configfs_write_iter+0x10d/0x1a0 fs/configfs/file.c:229
    new_sync_write fs/read_write.c:595 [inline]
    vfs_write+0x3ac/0x720 fs/read_write.c:687
    ksys_write+0xa5/0x170 fs/read_write.c:739
    do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
    do_syscall_64+0xf8/0x610 arch/x86/entry/syscall_64.c:94
    entry_SYSCALL_64_after_hwframe+0x77/0x7f

connection error: failed to recv *flatrpc.ExecutorMessageRawT: EOF


---
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@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [syzbot] [block?] memory leak in null_init_zoned_dev
  2026-08-14  0:03 [syzbot] [block?] memory leak in null_init_zoned_dev syzbot
@ 2026-08-14  4:50 ` Edward Adam Davis
  2026-08-14  8:06   ` syzbot
  2026-08-14  8:21 ` [PATCH] nullb: free zones when device is power-off Edward Adam Davis
  1 sibling, 1 reply; 4+ messages in thread
From: Edward Adam Davis @ 2026-08-14  4:50 UTC (permalink / raw)
  To: syzbot+f57d67a92532a98a562d; +Cc: linux-kernel, syzkaller-bugs

#syz test

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index f8c0fd57e041..fb001d002d17 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -511,6 +511,7 @@ static ssize_t nullb_device_power_store(struct config_item *item,
 		if (test_and_clear_bit(NULLB_DEV_FL_UP, &dev->flags)) {
 			dev->power = newp;
 			null_del_dev(dev->nullb);
+			null_free_zoned_dev(dev);
 		}
 		clear_bit(NULLB_DEV_FL_CONFIGURED, &dev->flags);
 	}


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [syzbot] [block?] memory leak in null_init_zoned_dev
  2026-08-14  4:50 ` Edward Adam Davis
@ 2026-08-14  8:06   ` syzbot
  0 siblings, 0 replies; 4+ messages in thread
From: syzbot @ 2026-08-14  8:06 UTC (permalink / raw)
  To: eadavis, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+f57d67a92532a98a562d@syzkaller.appspotmail.com
Tested-by: syzbot+f57d67a92532a98a562d@syzkaller.appspotmail.com

Tested on:

commit:         2f1baf1f Merge tag 'trace-v7.2-rc7' of git://git.kerne..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1096fac6580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=6843f8fd2336602d
dashboard link: https://syzkaller.appspot.com/bug?extid=f57d67a92532a98a562d
compiler:       gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
patch:          https://syzkaller.appspot.com/x/patch.diff?x=12ce0279580000

Note: testing is done by a robot and is best-effort only.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] nullb: free zones when device is power-off
  2026-08-14  0:03 [syzbot] [block?] memory leak in null_init_zoned_dev syzbot
  2026-08-14  4:50 ` Edward Adam Davis
@ 2026-08-14  8:21 ` Edward Adam Davis
  1 sibling, 0 replies; 4+ messages in thread
From: Edward Adam Davis @ 2026-08-14  8:21 UTC (permalink / raw)
  To: syzbot+f57d67a92532a98a562d
  Cc: axboe, shli, linux-block, linux-kernel, syzkaller-bugs

A user powers off the device by writing 0 to `./config/nullb/nullb1/power`
via the nullb configfs interface, and later powers it on by writing 1
to the same file.

When the power-off command is executed, the zones created by the previous
task are not freed before new zones are created upon powering on again;
this results in the memory leak described in [1].

Add an operation to free zones within nullb_device_power_store().

[1]
BUG: memory leak
unreferenced object 0xffff888126990000 (size 56000):
  backtrace (crc 5c9573f8):
    null_init_zoned_dev+0x108/0x520 drivers/block/null_blk/zoned.c:94
    null_add_dev+0x8a6/0xae0 drivers/block/null_blk/main.c:1993
    nullb_device_power_store+0xf9/0x1f0 drivers/block/null_blk/main.c:501
    flush_write_buffer fs/configfs/file.c:207 [inline]
    configfs_write_iter+0x10d/0x1a0 fs/configfs/file.c:229
    new_sync_write fs/read_write.c:595 [inline]
    vfs_write+0x3ac/0x720 fs/read_write.c:687

Fixes: cedcafad8277 ("nullb: add interface to power on disk")
Reported-by: syzbot+f57d67a92532a98a562d@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f57d67a92532a98a562d
Tested-by: syzbot+f57d67a92532a98a562d@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
 drivers/block/null_blk/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index f8c0fd57e041..fb001d002d17 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -511,6 +511,7 @@ static ssize_t nullb_device_power_store(struct config_item *item,
 		if (test_and_clear_bit(NULLB_DEV_FL_UP, &dev->flags)) {
 			dev->power = newp;
 			null_del_dev(dev->nullb);
+			null_free_zoned_dev(dev);
 		}
 		clear_bit(NULLB_DEV_FL_CONFIGURED, &dev->flags);
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-14  8:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14  0:03 [syzbot] [block?] memory leak in null_init_zoned_dev syzbot
2026-08-14  4:50 ` Edward Adam Davis
2026-08-14  8:06   ` syzbot
2026-08-14  8:21 ` [PATCH] nullb: free zones when device is power-off Edward Adam Davis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.