From nobody Sat Jul 25 04:30:08 2026 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (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 7ABC82FD1C2 for ; Sat, 18 Jul 2026 06:12:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784355169; cv=none; b=hgqrsSX9b6RUCjaYUMrdmh+WrhBp4iAlIR2pas19QRF/VMP6AVyKeZJfWTuKaxoHC5IrvxYaFjRMcpxrE70YrFMlr5igRBk0F6jiIZ9+xeWBILdReJJalLlwOIbDnE2Ho0cJiptgzsPJv7T7WnXEuHHlVy9mS/kWOicF590BzBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784355169; c=relaxed/simple; bh=NLo3I+oZZyEewRNeK63+aIuUyjiWKnnyHm42+GXFVdU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=mQBETf2FGPzgqbenjg79K3R0G/I6kFrX42JCS9Y2pVlQ4c6jC8gRtSa0Fr8xTgrYLoNnO+gYT6N6NIFZZ4HwrgmjLCHIqt1ot6+yYnYvrsE3IzyM0ddzg7eZWVXBTOpJg+1nbo76QNI40wt/cAZ9OiGXpvB0c5oSoE0iBBfwmi8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SiPplVAR; arc=none smtp.client-ip=209.85.215.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SiPplVAR" Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-c9c26a5fb98so1616682a12.0 for ; Fri, 17 Jul 2026 23:12:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784355168; x=1784959968; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=y2Z2iNsbJ6ytU6rjVo3MfoAErunYwfv2u8/ZImRbAoY=; b=SiPplVARWTl48IjBv5oxh21kFnTrP8fDjQXUigBWfh5rmX+7Fv1AV9P1VFdcYdB1rC RNTWlTxheAdWcuyYmgP89tsiP3hwoGpjShHmBY7yIAgVG9nJbHZoKlN9SpQN3g38t+NM E4jIVj/BA2z/d1wpL6Bj/SDWRphabmysXPmEQLIUGz4qS73w93lOExtiritwSC7ITo9S PfLds+Q13qGoZdhmmf0XEDicPFd2B8xuI6EZI9isl3IR9B/66nkscttMYWXdRr6v264K w/BO4vF/dVat7f2quhGbq1i9f4mHvhyW4+6KiDzY2wmFLFix9uYzOSzbhLspcdQQnuc8 Ck0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784355168; x=1784959968; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=y2Z2iNsbJ6ytU6rjVo3MfoAErunYwfv2u8/ZImRbAoY=; b=ILW7RxGATWa4TuAcoQIbYyB+10/7sLmdKnH1n6DaJR8ccTbCLFDwvRCb5e1Q5P4GA3 KwB1VHN6Jcf5rqaHhjK9Qnz3JUhvXeT6y2C8FZ08Hkr7ZWzyUPtqW1r+jwJucmHQ/K78 rtnOoYattq572ZEY4aNv79xHa/mUslU9S09vphWXSPgwKduiNqPWNbqcaPeJ2wzoc2WF TOgPHriYe0kLysotHHIl6TCgOd1aI9VW1V0K//RKjUxeJPY7oZkZecnjt89lynyKQFaD Te8m/R2Ob/j6OXc5HzAyh8+VUCShL4UbellwQx3Vi5ju73UgKPdZgGdSBJTpcDElu2Vk 4Tsg== X-Forwarded-Encrypted: i=1; AHgh+RqmJ5iD0KT33dJSKMevr9yc8FhCusibYvZLbrtI92biGD0R+L8F4oaoap3mwh3OkbFIfj6f/Y25UPP1RA4=@vger.kernel.org X-Gm-Message-State: AOJu0Ywl/ZqxxYpwyn2LeK5hGsizkfBU7Tjq1N8EtwnEeH+cDhzAu2Kz Xa5H1mKHFCA77qn+GGGSnYD2u62JeviYMirizR4JJGiy4+Igj1ATJALP2w9x1w== X-Gm-Gg: AfdE7cnz1lmi/OtVN9Ev7im6LzfuMYuO+4gzVvwOK3zvSF61GLqCi7EuTl2eyUZOz5p GBlv0I3+Qknhr6gyABZkTxi7B1qA/Kr+s5AzUvy2E78daRdo0tQuJw2Uhjg1LW+I5NxqgzvWabg m7WI6TYmbH+4SnQuFeLBQOWwHiG1Q7XKDnE482fISP6TXnHP+vLYHR8Gau3SjV/0a+p0B8wIh1N v6uxtHPgab8XHuUHvZ43PH56NlUUYSc3P+2SXwPxbDL3kfqCPZXA30XJBhDQjsfmEuV+lySoSY5 h9FhD7wUlI73BwbFDqXmZsinugJ+FnGr6bP6mR4Hl3SVtXmODJNPr916hhjvsw01G10ojJXAqpg 6spyuhMyC9T11hVN7E0tsml/TmOmLPkWn3quf8DYtAB5FzKJq/rrZIMJspFPDzi0NNXVvzgx3n/ XL5PZmVZs3WarAaWzk0T9SJibEj7Q3SkC3cgxip/as/b7OH+aT0V4AEmW+lg== X-Received: by 2002:a05:6a20:d492:b0:3c3:750f:3cf9 with SMTP id adf61e73a8af0-3c38d90c927mr11987195637.11.1784355167620; Fri, 17 Jul 2026 23:12:47 -0700 (PDT) Received: from deepanshu-kernel-hacker.. ([2405:201:682f:383f:ac40:5d70:cf7c:d0ce]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3142a1dd90fsm13604277eec.22.2026.07.17.23.12.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2026 23:12:46 -0700 (PDT) From: Deepanshu Kartikey To: tytso@mit.edu, adilger.kernel@dilger.ca, libaokun@linux.alibaba.com, jack@suse.cz, ojaswin@linux.ibm.com, ritesh.list@gmail.com, yi.zhang@huawei.com Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, Deepanshu Kartikey , syzbot+293a57918b36cfae3d48@syzkaller.appspotmail.com Subject: [PATCH] ext4: defend against inline-to-block conversion race in write completion Date: Sat, 18 Jul 2026 11:42:38 +0530 Message-ID: <20260718061238.50827-1-kartikey406@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace BUG_ON(!ext4_has_inline_data(inode)) with defensive error handling in ext4_write_inline_data_end(). A file can be converted from inline to blo= ck storage by concurrent paths while a write completion is in flight. Lock-based synchronization is impractical here since multiple conversion pa= ths use different locks. Defensive check with proper cleanup handles all races uniformly and safely. Reported-by: syzbot+293a57918b36cfae3d48@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D293a57918b36cfae3d48 Tested-by: syzbot+293a57918b36cfae3d48@syzkaller.appspotmail.com Signed-off-by: Deepanshu Kartikey --- fs/ext4/inline.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index 8045e4ff270c..53d783235da9 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -812,7 +812,14 @@ int ext4_write_inline_data_end(struct inode *inode, lo= ff_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)) { + ext4_write_unlock_xattr(inode, &no_expand); + brelse(iloc.bh); + folio_unlock(folio); + folio_put(folio); + return -EIO; + } =20 /* * ei->i_inline_off may have changed since --=20 2.43.0