From nobody Sat Feb 7 15:15:18 2026 Received: from mail-oa1-f69.google.com (mail-oa1-f69.google.com [209.85.160.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEB7F22576E for ; Sat, 7 Feb 2026 00:39:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.69 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770424754; cv=none; b=pJTFLaL31T1TZQkQ0pKUZQnqHPq6QOFjeGJwZdDD3U9Yjr4IV511cpmE8nl3WpC2jqRp9mOk/bJDh6f3pC1vL+Ji0/jILAEKKrXG8w8mS238X0XAknjNH1Z8d/I5KfDdwlOvlNtMbsRBzhhUZwbzSgfHKJfJ/KHsvgFA/k++28k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770424754; c=relaxed/simple; bh=MSXxUaxH9adngYgGKHG9tYefLtyoCa19QkwjSgfpIWY=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=H4iYWgymmSoVzLD1lrhtylxaOAbGa6YWGVV0qQSh0Jxb64iKetWxRbG79aML6c+8JnNFJAPu7DysCyoI1pa2bbsrg0KzTOn78hdmAM0rQ8Zi0gzylWiu4aqucTUdS8FZNcGd2jBsxbeLqbgADCqOkm5isgZEU017FEXp8dSqip0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.160.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oa1-f69.google.com with SMTP id 586e51a60fabf-409e0cc22c6so15235249fac.0 for ; Fri, 06 Feb 2026 16:39:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770424752; x=1771029552; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=am2+XpIgeS+Fs+jQHWD9kXQpD7BonyPPGQxNiPotnSw=; b=WHj2T9XvWW/FYgIO2jIAxPnQW5Ewq4KbeT8HE8XgqA4S41fU2qiWKFy3R6hSEjKn5Z 7Q9qYXSC8Wwd4/weFudeXtxmvW2aDM5w5/dvU4VR30WVWMFlJJmGO/uQk01Sxh4sWUO+ 3U4sVLeGkUVQ6RwUdChi1qtrzMTqYUVp64TnBQdDY51SvB/yAmfcQLSHtBFYBtWxK1OJ VkcyVSdNEvwZBVOLOVXaxPQmVLCqxgVlamKfXcGRV23E4LqxjexGzKACPgFpLTZUskq4 ug2/LSz4MZLHYCB8bUhBExErM3W7v7V7Y9DAontf8jIPtuGRzgk6NZeMvyq8l4Hq86MM ffNQ== X-Gm-Message-State: AOJu0Yyoutb45sCzlkhYdJiT3ANNdAgBGzMXmmBrXljyNT942Xp/G7zD g2Ns8CtgrQoy+jhZf+hHnAud7xAucmU53htOtyQZMk7BsXVpX/tOAVOJD7uL2cW/p1clSG9c3gp EUuwDTTpgUX/pNc0BluVNSuVY0zJdz/r6CMeDFWZW7SitBLPJhjhgevFwQkk= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:1626:b0:65c:fc4c:c66 with SMTP id 006d021491bc7-66ba73c47e9mr3807117eaf.22.1770424752672; Fri, 06 Feb 2026 16:39:12 -0800 (PST) Date: Fri, 06 Feb 2026 16:39:12 -0800 In-Reply-To: <6980e9ff.050a0220.16b13.00a9.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <698689b0.050a0220.3b3015.0049.GAE@google.com> Subject: Forwarded: [PATCH] ext4: convert inline data to extents when truncate exceeds inline size From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] ext4: convert inline data to extents when truncate exceeds= inline size Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= master Add a check in ext4_setattr() to convert files from inline data storage to extent-based storage when truncate() grows the file size beyond the inline capacity. This prevents the filesystem from entering an inconsistent state where the inline data flag is set but the file size exceeds what can be stored inline. Without this fix, the following sequence causes a kernel BUG_ON(): 1. Mount filesystem with inode that has inline flag set and small size 2. truncate(file, 50MB) - grows size but inline flag remains set 3. sendfile() attempts to write data 4. ext4_write_inline_data() hits BUG_ON(write_size > inline_capacity) The crash occurs because ext4_write_inline_data() expects inline storage to accommodate the write, but the actual inline capacity (~60 bytes for i_block + ~96 bytes for xattrs) is far smaller than the file size and write request. The fix checks if the new size from setattr exceeds the inode's actual inline capacity (EXT4_I(inode)->i_inline_size) and converts the file to extent-based storage before proceeding with the size change. A debug message is logged when conversion occurs to aid in diagnosis. This addresses the root cause by ensuring the inline data flag and file size remain consistent during truncate operations. Reported-by: syzbot+7de5fe447862fc37576f@syzkaller.appspotmail.com Link: https://syzkaller.appspot.com/bug?extid=3D7de5fe447862fc37576f Signed-off-by: Deepanshu Kartikey --- fs/ext4/inode.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 0c466ccbed69..a1eb6d15fc28 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5901,6 +5901,23 @@ int ext4_setattr(struct mnt_idmap *idmap, struct den= try *dentry, if (attr->ia_size =3D=3D inode->i_size) inc_ivers =3D false; =20 + /* + * If file has inline data but new size exceeds inline cap= acity, + * convert to extent-based storage first to prevent incons= istent + * state (inline flag set but size exceeds inline capacity= ). + */ + if (ext4_has_inline_data(inode) &&=20 + attr->ia_size > EXT4_I(inode)->i_inline_size) { + printk(KERN_WARNING "EXT4-fs: Converting inline data: inode=3D%lu old_s= ize=3D%lld new_size=3D%lld inline_size=3D%u\n", + inode->i_ino, + inode->i_size, + attr->ia_size, + EXT4_I(inode)->i_inline_size); + error =3D ext4_convert_inline_data(inode); + if (error) + goto err_out; + } + if (shrink) { if (ext4_should_order_data(inode)) { error =3D ext4_begin_ordered_truncate(inode, --=20 2.43.0