* [syzbot] [ntfs3?] memory leak in run_add_entry (2)
@ 2026-03-20 22:56 syzbot
2026-03-21 2:09 ` Forwarded: [PATCH] ntfs3: fix memory leak in indx_insert_into_root() syzbot
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: syzbot @ 2026-03-20 22:56 UTC (permalink / raw)
To: almaz.alexandrovich, linux-kernel, ntfs3, syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: 0e4f8f1a3d08 Merge tag 'parisc-for-7.0-rc5' of git://git.k..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=129f8cba580000
kernel config: https://syzkaller.appspot.com/x/.config?x=e2bba615ee79faa5
dashboard link: https://syzkaller.appspot.com/bug?extid=7adcddaeeb860e5d3f2f
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=1716bada580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=169f8cba580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/022aea4aa8f7/disk-0e4f8f1a.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/2698fe956577/vmlinux-0e4f8f1a.xz
kernel image: https://storage.googleapis.com/syzbot-assets/49c3df9c1f67/bzImage-0e4f8f1a.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/f0d7b4f7d563/mount_0.gz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+7adcddaeeb860e5d3f2f@syzkaller.appspotmail.com
BUG: memory leak
unreferenced object 0xffff88811e304200 (size 64):
comm "syz.0.17", pid 6098, jiffies 4294950427
hex dump (first 32 bytes):
00 00 00 00 01 00 00 00 1e 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace (crc 692543f4):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4543 [inline]
slab_alloc_node mm/slub.c:4866 [inline]
__do_kmalloc_node mm/slub.c:5259 [inline]
__kvmalloc_node_noprof+0x53d/0x770 mm/slub.c:6752
run_add_entry+0x108/0x730 fs/ntfs3/run.c:390
attr_allocate_clusters+0x15a/0x450 fs/ntfs3/attrib.c:199
indx_create_allocate fs/ntfs3/index.c:1449 [inline]
indx_insert_into_root+0x575/0xb20 fs/ntfs3/index.c:1705
indx_insert_entry+0x182/0x290 fs/ntfs3/index.c:1993
ni_add_name+0x1ab/0x2e0 fs/ntfs3/frecord.c:2764
ntfs_link_inode+0x95/0xc0 fs/ntfs3/inode.c:1794
ntfs_link+0xb4/0x180 fs/ntfs3/namei.c:146
vfs_link+0x270/0x5a0 fs/namei.c:5746
filename_linkat+0x262/0x3c0 fs/namei.c:5814
__do_sys_link fs/namei.c:5847 [inline]
__se_sys_link fs/namei.c:5843 [inline]
__x64_sys_link+0x4b/0x70 fs/namei.c:5843
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
BUG: memory leak
unreferenced object 0xffff888105b7a380 (size 64):
comm "syz.0.18", pid 6114, jiffies 4294950436
hex dump (first 32 bytes):
00 00 00 00 01 00 00 00 1e 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace (crc 692543f4):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4543 [inline]
slab_alloc_node mm/slub.c:4866 [inline]
__do_kmalloc_node mm/slub.c:5259 [inline]
__kvmalloc_node_noprof+0x53d/0x770 mm/slub.c:6752
run_add_entry+0x108/0x730 fs/ntfs3/run.c:390
attr_allocate_clusters+0x15a/0x450 fs/ntfs3/attrib.c:199
indx_create_allocate fs/ntfs3/index.c:1449 [inline]
indx_insert_into_root+0x575/0xb20 fs/ntfs3/index.c:1705
indx_insert_entry+0x182/0x290 fs/ntfs3/index.c:1993
ni_add_name+0x1ab/0x2e0 fs/ntfs3/frecord.c:2764
ntfs_link_inode+0x95/0xc0 fs/ntfs3/inode.c:1794
ntfs_link+0xb4/0x180 fs/ntfs3/namei.c:146
vfs_link+0x270/0x5a0 fs/namei.c:5746
filename_linkat+0x262/0x3c0 fs/namei.c:5814
__do_sys_link fs/namei.c:5847 [inline]
__se_sys_link fs/namei.c:5843 [inline]
__x64_sys_link+0x4b/0x70 fs/namei.c:5843
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
BUG: memory leak
unreferenced object 0xffff88810ea19a40 (size 64):
comm "syz.0.19", pid 6125, jiffies 4294950445
hex dump (first 32 bytes):
00 00 00 00 01 00 00 00 1e 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace (crc 692543f4):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4543 [inline]
slab_alloc_node mm/slub.c:4866 [inline]
__do_kmalloc_node mm/slub.c:5259 [inline]
__kvmalloc_node_noprof+0x53d/0x770 mm/slub.c:6752
run_add_entry+0x108/0x730 fs/ntfs3/run.c:390
attr_allocate_clusters+0x15a/0x450 fs/ntfs3/attrib.c:199
indx_create_allocate fs/ntfs3/index.c:1449 [inline]
indx_insert_into_root+0x575/0xb20 fs/ntfs3/index.c:1705
indx_insert_entry+0x182/0x290 fs/ntfs3/index.c:1993
ni_add_name+0x1ab/0x2e0 fs/ntfs3/frecord.c:2764
ntfs_link_inode+0x95/0xc0 fs/ntfs3/inode.c:1794
ntfs_link+0xb4/0x180 fs/ntfs3/namei.c:146
vfs_link+0x270/0x5a0 fs/namei.c:5746
filename_linkat+0x262/0x3c0 fs/namei.c:5814
__do_sys_link fs/namei.c:5847 [inline]
__se_sys_link fs/namei.c:5843 [inline]
__x64_sys_link+0x4b/0x70 fs/namei.c:5843
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xe2/0xf80 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] 5+ messages in thread* Forwarded: [PATCH] ntfs3: fix memory leak in indx_insert_into_root() 2026-03-20 22:56 [syzbot] [ntfs3?] memory leak in run_add_entry (2) syzbot @ 2026-03-21 2:09 ` syzbot 2026-03-21 3:58 ` syzbot 2026-03-21 4:52 ` [syzbot] [ntfs3?] memory leak in run_add_entry (2) Edward Adam Davis 2 siblings, 0 replies; 5+ messages in thread From: syzbot @ 2026-03-21 2:09 UTC (permalink / raw) To: linux-kernel, syzkaller-bugs For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] ntfs3: fix memory leak in indx_insert_into_root() Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master When indx_create_allocate() succeeds but a subsequent operation fails (indx_get_root() returning NULL, indx_new() failing, or the allocation itself failing), the run list allocated in run_add_entry() via attr_allocate_clusters() is never freed, causing a memory leak. Fix this by adding a new out_free_alloc label that calls run_close() on indx->alloc_run before the existing cleanup labels, and redirecting the affected error paths to use it. Reported-by: syzbot+7adcddaeeb860e5d3f2f@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=7adcddaeeb860e5d3f2f Signed-off-by: Deepanshu Kartikey <Kartikey406@gmail.com> --- fs/ntfs3/index.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c index 97f06c26fe1a..16479b6ce845 100644 --- a/fs/ntfs3/index.c +++ b/fs/ntfs3/index.c @@ -1711,7 +1711,7 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni, /* Bug? */ ntfs_set_state(sbi, NTFS_DIRTY_ERROR); err = -EINVAL; - goto out_free_re; + goto out_free_alloc; } if (err) { @@ -1722,7 +1722,7 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni, /* Bug? */ ntfs_set_state(sbi, NTFS_DIRTY_ERROR); } - goto out_free_re; + goto out_free_alloc; } e = (struct NTFS_DE *)(root + 1); @@ -1733,7 +1733,7 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni, n = indx_new(indx, ni, new_vbn, sub_vbn); if (IS_ERR(n)) { err = PTR_ERR(n); - goto out_free_re; + goto out_free_alloc; } hdr = &n->index->ihdr; @@ -1781,6 +1781,8 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni, out_put_n: put_indx_node(n); +out_free_alloc: + run_close(&indx->alloc_run); out_free_re: kfree(re); out_free_root: -- 2.43.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Forwarded: [PATCH] ntfs3: fix memory leak in indx_insert_into_root() 2026-03-20 22:56 [syzbot] [ntfs3?] memory leak in run_add_entry (2) syzbot 2026-03-21 2:09 ` Forwarded: [PATCH] ntfs3: fix memory leak in indx_insert_into_root() syzbot @ 2026-03-21 3:58 ` syzbot 2026-03-21 4:52 ` [syzbot] [ntfs3?] memory leak in run_add_entry (2) Edward Adam Davis 2 siblings, 0 replies; 5+ messages in thread From: syzbot @ 2026-03-21 3:58 UTC (permalink / raw) To: linux-kernel, syzkaller-bugs For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] ntfs3: fix memory leak in indx_insert_into_root() Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master Two memory leak paths exist in the NTFS3 index allocation code: 1. When indx_create_allocate() fails internally, run_deallocate() frees disk clusters but never frees the run.runs memory allocated by attr_allocate_clusters() via run_add_entry(). Fix by adding run_close(&run) at the out: label. 2. When indx_create_allocate() succeeds but a subsequent operation fails (indx_get_root() returning NULL, indx_new() failing), the run list copied into indx->alloc_run is never freed. Fix by adding out_free_alloc label that calls run_close(&indx->alloc_run). Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Reported-by: syzbot+7adcddaeeb860e5d3f2f@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=7adcddaeeb860e5d3f2f Signed-off-by: Deepanshu Kartikey <Kartikey406@gmail.com> --- fs/ntfs3/index.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c index 97f06c26fe1a..6ec351681ddc 100644 --- a/fs/ntfs3/index.c +++ b/fs/ntfs3/index.c @@ -1481,6 +1481,7 @@ static int indx_create_allocate(struct ntfs_index *indx, struct ntfs_inode *ni, run_deallocate(sbi, &run, false); out: + run_close(&run); return err; } @@ -1711,7 +1712,7 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni, /* Bug? */ ntfs_set_state(sbi, NTFS_DIRTY_ERROR); err = -EINVAL; - goto out_free_re; + goto out_free_alloc; } if (err) { @@ -1722,7 +1723,7 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni, /* Bug? */ ntfs_set_state(sbi, NTFS_DIRTY_ERROR); } - goto out_free_re; + goto out_free_alloc; } e = (struct NTFS_DE *)(root + 1); @@ -1733,7 +1734,7 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni, n = indx_new(indx, ni, new_vbn, sub_vbn); if (IS_ERR(n)) { err = PTR_ERR(n); - goto out_free_re; + goto out_free_alloc; } hdr = &n->index->ihdr; @@ -1781,6 +1782,8 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni, out_put_n: put_indx_node(n); +out_free_alloc: + run_close(&indx->alloc_run); out_free_re: kfree(re); out_free_root: -- 2.43.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [syzbot] [ntfs3?] memory leak in run_add_entry (2) 2026-03-20 22:56 [syzbot] [ntfs3?] memory leak in run_add_entry (2) syzbot 2026-03-21 2:09 ` Forwarded: [PATCH] ntfs3: fix memory leak in indx_insert_into_root() syzbot 2026-03-21 3:58 ` syzbot @ 2026-03-21 4:52 ` Edward Adam Davis 2026-03-21 6:02 ` syzbot 2 siblings, 1 reply; 5+ messages in thread From: Edward Adam Davis @ 2026-03-21 4:52 UTC (permalink / raw) To: syzbot+7adcddaeeb860e5d3f2f; +Cc: linux-kernel, syzkaller-bugs #syz test diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c index 97f06c26fe1a..11f59d7b9ea4 100644 --- a/fs/ntfs3/index.c +++ b/fs/ntfs3/index.c @@ -1481,6 +1481,7 @@ static int indx_create_allocate(struct ntfs_index *indx, struct ntfs_inode *ni, run_deallocate(sbi, &run, false); out: + run_close(&run); return err; } ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [syzbot] [ntfs3?] memory leak in run_add_entry (2) 2026-03-21 4:52 ` [syzbot] [ntfs3?] memory leak in run_add_entry (2) Edward Adam Davis @ 2026-03-21 6:02 ` syzbot 0 siblings, 0 replies; 5+ messages in thread From: syzbot @ 2026-03-21 6:02 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+7adcddaeeb860e5d3f2f@syzkaller.appspotmail.com Tested-by: syzbot+7adcddaeeb860e5d3f2f@syzkaller.appspotmail.com Tested on: commit: a0c83177 Merge tag 'drm-fixes-2026-03-21' of https://g.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=11dad0ca580000 kernel config: https://syzkaller.appspot.com/x/.config?x=e2bba615ee79faa5 dashboard link: https://syzkaller.appspot.com/bug?extid=7adcddaeeb860e5d3f2f 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=1345ca06580000 Note: testing is done by a robot and is best-effort only. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-03-21 6:02 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-03-20 22:56 [syzbot] [ntfs3?] memory leak in run_add_entry (2) syzbot 2026-03-21 2:09 ` Forwarded: [PATCH] ntfs3: fix memory leak in indx_insert_into_root() syzbot 2026-03-21 3:58 ` syzbot 2026-03-21 4:52 ` [syzbot] [ntfs3?] memory leak in run_add_entry (2) Edward Adam Davis 2026-03-21 6:02 ` syzbot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox