* [PATCH] ext4: attach jinode before inline data conversion in setattr [not found] <6afa2521.84fe3b82.798c4.0005.GAE@google.com> @ 2026-11-16 5:44 ` Qing Zhang 2026-11-16 5:44 ` syzbot 0 siblings, 1 reply; 2+ messages in thread From: Qing Zhang @ 2026-11-16 5:44 UTC (permalink / raw) To: tytso Cc: adilger.kernel, libaokun, jack, ojaswin, ritesh.list, kartikey406, yi.zhang, linux-ext4, linux-kernel, Qing Zhang, Ahmed Khan, syzbot+9c29b92a3b6500bb347d, stable Commit ed9356a30e59 ("ext4: convert inline data to extents when truncate exceeds inline size") added inline data conversion to ext4_setattr(). Pathname-based truncate bypasses ext4_file_open(), so the inode may lack a jinode. In ordered mode, the conversion can pass this NULL jinode to jbd2_journal_file_inode(), causing a NULL pointer dereference. Attach the jinode before ext4_convert_inline_data() and propagate attachment errors. The attachment in ext4_truncate_up() occurs after the conversion and is too late. Fixes: ed9356a30e59 ("ext4: convert inline data to extents when truncate exceeds inline size") Reported-by: Ahmed Khan <ahmadpsn95@gmail.com> Link: https://lore.kernel.org/r/CAOaS1==g3mdoqmS2AjOC0_-woXJbA_X0LJQt7+M7d1=+gfyQqw@mail.gmail.com Reported-by: syzbot+9c29b92a3b6500bb347d@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=9c29b92a3b6500bb347d Cc: stable@vger.kernel.org Signed-off-by: Qing Zhang <diasyzhang@tencent.com> --- #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master fs/ext4/inode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 10cd85d4c721..1e31933ae98c 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -7127,6 +7127,9 @@ int ext4_setattr(const struct mnt_idmap *idmap, struct dentry *dentry, */ if (ext4_has_inline_data(inode) && attr->ia_size > EXT4_I(inode)->i_inline_size) { + error = ext4_inode_attach_jinode(inode); + if (error) + goto err_out; error = ext4_convert_inline_data(inode); if (error) goto err_out; -- 2.43.7 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ext4: attach jinode before inline data conversion in setattr 2026-11-16 5:44 ` [PATCH] ext4: attach jinode before inline data conversion in setattr Qing Zhang @ 2026-11-16 5:44 ` syzbot 0 siblings, 0 replies; 2+ messages in thread From: syzbot @ 2026-11-16 5:44 UTC (permalink / raw) To: diasyzhangqing Cc: adilger.kernel, ahmadpsn95, diasyzhang, diasyzhangqing, jack, kartikey406, libaokun, linux-ext4, linux-kernel, ojaswin, ritesh.list, stable, tytso, yi.zhang, syzkaller-bugs > Commit ed9356a30e59 ("ext4: convert inline data to extents when > truncate exceeds inline size") added inline data conversion to > ext4_setattr(). Pathname-based truncate bypasses ext4_file_open(), > so the inode may lack a jinode. In ordered mode, the conversion > can pass this NULL jinode to jbd2_journal_file_inode(), causing a > NULL pointer dereference. > > Attach the jinode before ext4_convert_inline_data() and propagate > attachment errors. The attachment in ext4_truncate_up() occurs > after the conversion and is too late. > > Fixes: ed9356a30e59 ("ext4: convert inline data to extents when truncate exceeds inline size") > Reported-by: Ahmed Khan <ahmadpsn95@gmail.com> > Link: https://lore.kernel.org/r/CAOaS1==g3mdoqmS2AjOC0_-woXJbA_X0LJQt7+M7d1=+gfyQqw@mail.gmail.com > Reported-by: syzbot+9c29b92a3b6500bb347d@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=9c29b92a3b6500bb347d > Cc: stable@vger.kernel.org > Signed-off-by: Qing Zhang <diasyzhang@tencent.com> > --- > > #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master Patch testing via #syz test is temporarily disabled. See https://github.com/google/syzkaller/issues/8122 for details. > fs/ext4/inode.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c > index 10cd85d4c721..1e31933ae98c 100644 > --- a/fs/ext4/inode.c > +++ b/fs/ext4/inode.c > @@ -7127,6 +7127,9 @@ int ext4_setattr(const struct mnt_idmap *idmap, struct dentry *dentry, > */ > if (ext4_has_inline_data(inode) && > attr->ia_size > EXT4_I(inode)->i_inline_size) { > + error = ext4_inode_attach_jinode(inode); > + if (error) > + goto err_out; > error = ext4_convert_inline_data(inode); > if (error) > goto err_out; > -- > 2.43.7 > ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-16 5:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <6afa2521.84fe3b82.798c4.0005.GAE@google.com>
2026-11-16 5:44 ` [PATCH] ext4: attach jinode before inline data conversion in setattr Qing Zhang
2026-11-16 5:44 ` syzbot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox