From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10443302CA6; Tue, 26 Aug 2025 13:52:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756216376; cv=none; b=M/b3qYxTk2eB+OVPkd6wL+JdVndHf/cz1Tz+sYYWt34JORf/KBRdzBakuhMn8QSclUDk7vAGkSPDziutWe8KXjcXwOmKvH3RkUBvgyEbLl/oaysKo55hSBD5yBDkjYGfzyhLmrSQvR86oWCd3tTCcLOzkyC4Wi5im4Csq2hbd5k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756216376; c=relaxed/simple; bh=cOsUUdQIIAke7XPKmn+0abAnb5z2MGPgYPOVWVbNejE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q0JZpx7cuBIZdjeAohr50ZOFu5EVVzyEdAJ0CeOgu8h3/vmPzJpwPZavjMobAkjRdqqeRAW9HZO4ONuepgI2C91p7lQ6kP+xzAxDDVV9WhNiN/3yHuK8l5/3mTAtL/uBx+Dblc3i0l2hXB3y6TBNtEKkxvQ1KKeHL0+Kpen7d3Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HSQkj93Q; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="HSQkj93Q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95056C4CEF1; Tue, 26 Aug 2025 13:52:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756216375; bh=cOsUUdQIIAke7XPKmn+0abAnb5z2MGPgYPOVWVbNejE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HSQkj93QAu9veg66DtZjPWSf2g+sC4D4dBBLJYk4V1ilKKQCaCKqNuvC1NEBJXq4f 34i5QaLf7d3clBopOQwQ/WRiix75AV8qEiaOaM9h59sFRGDl9tRcACvxUznDoncTUT YU1OxE1Uz8AgXsxXqky04L3RxuECQ053Sl40FTpE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+544248a761451c0df72f@syzkaller.appspotmail.com, Theodore Tso , Sasha Levin Subject: [PATCH 5.15 386/644] ext4: do not BUG when INLINE_DATA_FL lacks system.data xattr Date: Tue, 26 Aug 2025 13:07:57 +0200 Message-ID: <20250826110956.004630513@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110946.507083938@linuxfoundation.org> References: <20250826110946.507083938@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Theodore Ts'o [ Upstream commit 099b847ccc6c1ad2f805d13cfbcc83f5b6d4bc42 ] A syzbot fuzzed image triggered a BUG_ON in ext4_update_inline_data() when an inode had the INLINE_DATA_FL flag set but was missing the system.data extended attribute. Since this can happen due to a maiciouly fuzzed file system, we shouldn't BUG, but rather, report it as a corrupted file system. Add similar replacements of BUG_ON with EXT4_ERROR_INODE() ii ext4_create_inline_data() and ext4_inline_data_truncate(). Reported-by: syzbot+544248a761451c0df72f@syzkaller.appspotmail.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin --- fs/ext4/inline.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index a1cc14156ced..d2cdb151a9c1 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -298,7 +298,11 @@ static int ext4_create_inline_data(handle_t *handle, if (error) goto out; - BUG_ON(!is.s.not_found); + if (!is.s.not_found) { + EXT4_ERROR_INODE(inode, "unexpected inline data xattr"); + error = -EFSCORRUPTED; + goto out; + } error = ext4_xattr_ibody_set(handle, inode, &i, &is); if (error) { @@ -349,7 +353,11 @@ static int ext4_update_inline_data(handle_t *handle, struct inode *inode, if (error) goto out; - BUG_ON(is.s.not_found); + if (is.s.not_found) { + EXT4_ERROR_INODE(inode, "missing inline data xattr"); + error = -EFSCORRUPTED; + goto out; + } len -= EXT4_MIN_INLINE_DATA_SIZE; value = kzalloc(len, GFP_NOFS); @@ -1981,7 +1989,12 @@ int ext4_inline_data_truncate(struct inode *inode, int *has_inline) if ((err = ext4_xattr_ibody_find(inode, &i, &is)) != 0) goto out_error; - BUG_ON(is.s.not_found); + if (is.s.not_found) { + EXT4_ERROR_INODE(inode, + "missing inline data xattr"); + err = -EFSCORRUPTED; + goto out_error; + } value_len = le32_to_cpu(is.s.here->e_value_size); value = kmalloc(value_len, GFP_NOFS); -- 2.39.5