From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.30.130 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793872197; b=JEcKMN8LBBF8+iDFSQnHnBlITqd/An9b4D/YrdsMqCxuf0DsKjLM4T8D/lHqeeEHbKrK 3VXlJG+Earf96x1Piof3oZGBfmQ38HZf0JiTDJit9zjJUNme6UdAB/KQ6zsOZLyzIZa4b hZdUuOEzziouqvmlLYQqI5xtj4SuIAjGidWgNyvbv3gyRSlFtWlV8vFuG1wl9AxifTpj6 qnaOF29BM2+QUMTULDkdZfUgxpv3ZOK05+2Dy2wy7O1JvABZng4XmtRzKp1aN71M/My7Z sZmogBvQ56paY9KyAFFVj49NSg+VZazbD56hL1IUWm90bIIpy8QSPOmPimFEJejYwyg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793872197; h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:From:To:Cc: Subject:Date:Message-Id:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=ljQIicNK0HUVF4+og/onCbX4zTFPfDAbmm/iUvXZnVc=; b=JLH2yWvDd10CPS6nFxyerWOo6585p74f7DJALq0ZvltBtb4SeJCgDY64QlF2NHB0pKJ2 qofWdSsqIGa2hGux4HE0YW95Qt9N9OFSvpbNmCymuMDWYa43olZSUNYvqdzuRNjap//uV aUtcTCwuvLv3Ho6bnHBeLZOG5fBG5zFMt6TQvrA+Oe4ZtHrXcvSqtRYisB+CmpUUvY4Bh o8+PlvogsYwh60Mw5CpVuvcu85+6zA8915t5lgcQlda0ncVOM5DD/nfcoavxE0AtP1Ere Fws7wHj5ntBHoZYpSaoBLFK8Yotlm/VpeHl3hJcLQF8015R8NQXONkSe1/Jg4UmwOwA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=Rl+3NA0s; arc=none smtp.remote-ip=115.124.30.130 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 522C560A3839 for ; Thu, 5 Nov 2026 09:49:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 522C560A3839 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=Rl+3NA0s DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1793872192; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=ljQIicNK0HUVF4+og/onCbX4zTFPfDAbmm/iUvXZnVc=; b=Rl+3NA0sXg4fIhn68ywjpiqad66hsqRlQCuBWwH9YpHiak1Bzn9BT4GBWjkUw5cG5EplhICWKusNYXed0D13nsmFnYBdz+gBR/D6N8pWxaNozM6f1+oIcuPkS7TFl0+xVgvKvACPC1ac100yjgLoOvd55vxyklWSzjEtzTQyTr8= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045133197;MF=joseph.qi@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0XE8RZg2_1793872191; Received: from localhost(mailfrom:joseph.qi@linux.alibaba.com fp:SMTPD_---0XE8RZg2_1793872191 cluster:ay36) by smtp.aliyun-inc.com; Thu, 05 Nov 2026 17:49:52 +0800 From: Joseph Qi To: Andrew Morton , Heming Zhao Cc: Mark Fasheh , Joel Becker , ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org, Joseph Qi Subject: [PATCH 26/30] ocfs2: check inline data dinodes in online filecheck Date: Thu, 5 Nov 2026 17:49:22 +0800 Message-Id: <20261105094926.3203416-27-joseph.qi@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20261105094926.3203416-1-joseph.qi@linux.alibaba.com> References: <20261105094926.3203416-1-joseph.qi@linux.alibaba.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Wire the inline-data guard and its three sub-checks into the filecheck validator: allocated clusters on an inline inode, an id_count beyond the space available in the inode block, and an i_size beyond id_count. The size-without-clusters check now needs an explicit goto bail. It previously fell through to the bail label because it was the last check; with checks following it, a later failure would overwrite its INVALIDINO code and report the wrong reason. The id_count maximum stays a signed int in the message. ocfs2_max_inline_data_with_xattr() subtracts the unvalidated i_xattr_inline_size and can go negative on small block sizes. Signed-off-by: Joseph Qi --- fs/ocfs2/inode.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index db8cdf4d8627..06b190b00590 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c @@ -2094,6 +2094,40 @@ static int ocfs2_filecheck_validate_inode_block(struct super_block *sb, (unsigned long long)bh->b_blocknr, (unsigned long long)le64_to_cpu(di->i_size)); rc = -OCFS2_FILECHECK_ERR_INVALIDINO; + goto bail; + } + + if (ocfs2_dinode_has_inline_data(di)) { + struct ocfs2_inline_data *data = &di->id2.i_data; + + if (ocfs2_dinode_has_inline_clusters(di)) { + mlog(ML_ERROR, + "Filecheck: invalid dinode #%llu: %u clusters\n", + (unsigned long long)bh->b_blocknr, + le32_to_cpu(di->i_clusters)); + rc = -OCFS2_FILECHECK_ERR_INVALIDINO; + goto bail; + } + + if (ocfs2_dinode_has_oversized_inline_data(sb, di)) { + mlog(ML_ERROR, + "Filecheck: invalid dinode #%llu: inline data id_count %u exceeds max %d\n", + (unsigned long long)bh->b_blocknr, + le16_to_cpu(data->id_count), + ocfs2_max_inline_data_with_xattr(sb, di)); + rc = -OCFS2_FILECHECK_ERR_INVALIDINO; + goto bail; + } + + if (ocfs2_dinode_has_inline_size_over_count(di)) { + mlog(ML_ERROR, + "Filecheck: invalid dinode #%llu: inline data i_size %llu exceeds id_count %u\n", + (unsigned long long)bh->b_blocknr, + (unsigned long long)le64_to_cpu(di->i_size), + le16_to_cpu(data->id_count)); + rc = -OCFS2_FILECHECK_ERR_INVALIDINO; + goto bail; + } } bail: -- 2.39.3