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 A4B1A265624; Mon, 7 Apr 2025 18:14:23 +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=1744049663; cv=none; b=h9dNn27XQ2HPl/Xhz3m6fh3T9tp4tUs7yPEtAoD4jQN4ea4tbQ3lfspXWt2IdhpFNae6Nk2Hc8ssLrJQdXd7JWjTd30G2Ma2z2YP8uWZ8xFZsTVbx3v0X5Mz8FhXll/nchgsdrJWZH2ZzuH6/fYOnOD1CoP8SCqLh5cFPDjaF0o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744049663; c=relaxed/simple; bh=2DXTB/+he9rBJW+Wnf2nKqO6DyEMzbVKsBULcUOYIQA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ns79w1nEwXo502d9FroXa8tQyEZDLH4Wpx9MbU+211Q+K6fzrTmHsQcG4hn/0inqpaXqBfdjivyNpr7ivj9lTb/Bt+RODUXPEVKiKE4yq4WDJqbiQX+QyB97EoiZBTfgB/rguBzdWAhM9bhJEZrh0FuxkWAbwn/IfPdg8L5Wt3E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dAXNwQzJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dAXNwQzJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC472C4CEDD; Mon, 7 Apr 2025 18:14:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744049663; bh=2DXTB/+he9rBJW+Wnf2nKqO6DyEMzbVKsBULcUOYIQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dAXNwQzJ6Suop2Tt+OuabXcpC3eDPzOoqhx+MlI6pfsgXFDLkotj6P0MPSWLXNNTY nisVBfvg2Oak6uaG7/jfPqUq++TMCkjhcrFcV+Mc6E8+0hsx/miqo03ZKBPLdZQbv2 7fUDge4vUSpFEyTnKqQo6BuW4JYlSRTC2Djf3CPI7yvZNosWuI+GCKpHZH8BP4wLr7 CXkjMQAoxZCl6iw2D9aJ7kXrPr0qY7wLsycV2tvKTxv3LQ3qZ2H93Lyjsf3aTL5TGb 4lCml07rfBpwexYYAfYhy5DfLdin1YS5z7mDT38YuVRQaR+YJIaQQq077kxHd4UbQU xqeGTS//sahYg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Edward Adam Davis , syzbot+e37dd1dfc814b10caa55@syzkaller.appspotmail.com, Konstantin Komarov , Sasha Levin , ntfs3@lists.linux.dev Subject: [PATCH AUTOSEL 6.6 02/15] fs/ntfs3: Fix WARNING in ntfs_extend_initialized_size Date: Mon, 7 Apr 2025 14:14:02 -0400 Message-Id: <20250407181417.3183475-2-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250407181417.3183475-1-sashal@kernel.org> References: <20250407181417.3183475-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: ntfs3@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.6.86 Content-Transfer-Encoding: 8bit From: Edward Adam Davis [ Upstream commit ff355926445897cc9fdea3b00611e514232c213c ] Syzbot reported a WARNING in ntfs_extend_initialized_size. The data type of in->i_valid and to is u64 in ntfs_file_mmap(). If their values are greater than LLONG_MAX, overflow will occur because the data types of the parameters valid and new_valid corresponding to the function ntfs_extend_initialized_size() are loff_t. Before calling ntfs_extend_initialized_size() in the ntfs_file_mmap(), the "ni->i_valid < to" has been determined, so the same WARN_ON determination is not required in ntfs_extend_initialized_size(). Just execute the ntfs_extend_initialized_size() in ntfs_extend() to make a WARN_ON check. Reported-and-tested-by: syzbot+e37dd1dfc814b10caa55@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=e37dd1dfc814b10caa55 Signed-off-by: Edward Adam Davis Signed-off-by: Konstantin Komarov Signed-off-by: Sasha Levin --- fs/ntfs3/file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index 2ecd0303f9421..4aea458216117 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -335,6 +335,7 @@ static int ntfs_extend(struct inode *inode, loff_t pos, size_t count, } if (extend_init && !is_compressed(ni)) { + WARN_ON(ni->i_valid >= pos); err = ntfs_extend_initialized_size(file, ni, ni->i_valid, pos); if (err) goto out; -- 2.39.5