From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) (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 1442339CD16 for ; Fri, 17 Jul 2026 09:15:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784279714; cv=none; b=PeY/NhOe2Jv64B9W8ecxdXACVOQM4wJSU4qpBe+z0lretRtJyenuR4fWS/acxecfbd3pw/olSRmu4tfQRLoaCFhfd+UIQEToInwzS0MCB6/r1A+7eyzmJhiLJo649DXOAqCg3vWhY4exgoBAW63BOfp7xRDz4KQzIN/heT/T9nc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784279714; c=relaxed/simple; bh=PRSKt45Vp7IVglxxyfyhhoU1WDXrtDf4LFBpsvQWS5Q=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=OAjOKP69VeAy4WmnJqW+PIWc6w3y/s+H8o3N3PnjOWd0r8Hb2VIzlAb/S6D11GSgyh5yOjIMm1u039tnjcZZm2OTzBGRa3Q72BIbOlDkWB+ORuZBUtblygkGVohktjGIzJQG+vItFZJSU2k+kgTb7CGfhJm24zDKQ2hSJ4V7RmE= 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.167.197 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-oi1-f197.google.com with SMTP id 5614622812f47-4a49f09233dso2138991b6e.2 for ; Fri, 17 Jul 2026 02:15:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784279707; x=1784884507; h=content-type:to:from:subject:message-id:in-reply-to:date :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=O6Pvbb2zkE2Y7dto0TqojePwlD45FueuPliUTRRf5MQ=; b=j4fm35Toq+UbDHA1mWddd7Ffur42By5UclRVXQOYKPZ9fWwbUKaSWA2ewEiAiSXyms 9fmEPMW9pAp/xP3BlQMqCvUE5y+Yk6QcZ/RzkFX2o01CCihp9kW19uZ7OmYRzGdv+BFi 6ADFrJa6dySA50b/w1MzDorN3rMUy67tLOOKwc90Lx6KiYF7vIu0KEk9VTMY+XaPZkbJ BqXeqP93XSoclcmR5Cl40fAkSWoMYReOm1NHv8K6KLSgO8j0MVZltcmLnyXPONWHlDbQ tFhquBbafEBmbuqMSS341Di4H/GKfEIqKqreY8NFhLNbYEpZjA4ABsM7g/bUQ97pHM4Q DTdw== X-Gm-Message-State: AOJu0Yx8TLxZxeDQ7iiKaOEtAgh6vDJXsb7GjjYynJsMwr9Aw8AOgY/+ 1rl/rwbXRWcv6aYNVGqRlHjc974tRa/mNDh0sUprqp30QylcglnkFxBZK/Ye9BRJ3Gdt+G8OThj OjDplB3P0PoT8lzl3+sqYJyBaNT9Cjc8RMiESMFZJJ666t37oiIJ7NcNo7Oc= 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:6808:14c6:b0:4a4:933:b1aa with SMTP id 5614622812f47-4a4d03204a2mr860608b6e.26.1784279706942; Fri, 17 Jul 2026 02:15:06 -0700 (PDT) Date: Fri, 17 Jul 2026 02:15:06 -0700 In-Reply-To: <6a588d44.c96faac9.59e0.0012.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6a59f29a.5622734e.c905.003f.GAE@google.com> Subject: Forwarded: [PATCH] ext4: fix race in ext4_write_inline_data_end() by making it defensive From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com 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: fix race in ext4_write_inline_data_end() by making it defensive Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci Replace BUG_ON(!ext4_has_inline_data(inode)) with a defensive check in ext4_write_inline_data_end(). This handles the race condition where a file can be converted from inline to block storage by concurrent paths while a write completion is in flight. Multiple inline-to-block conversion paths exist and use different locking mechanisms (ext4_convert_inline_data_nolock uses i_data_sem, while ext4_convert_inline_data_to_extent and ext4_da_convert_inline_data_to_extent use xattr_sem). A write that began on an inline file can reach completion after the file has been converted to blocks by one of these paths. Instead of crashing with BUG_ON, gracefully fall back to block_write_end() when the file has already been converted. The data is already in blocks at this point, so the fallback is correct. Reported-by: syzbot+293a57918b36cfae3d48@syzkaller.appspotmail.com Link: https://syzkaller.appspot.com/bug?extid=293a57918b36cfae3d48 Signed-off-by: Deepanshu Kartikey --- fs/ext4/inline.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index 8045e4ff270c..0a5404fe5bc5 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -812,7 +812,10 @@ int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len, goto out; } ext4_write_lock_xattr(inode, &no_expand); - BUG_ON(!ext4_has_inline_data(inode)); + /* File may have been converted to block storage by concurrent path */ + if (!ext4_has_inline_data(inode)) { + return block_write_end(pos, len, copied, folio); + } /* * ei->i_inline_off may have changed since -- 2.43.0