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 4B2AE2144DF; Tue, 4 Feb 2025 01:18:21 +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=1738631902; cv=none; b=Dp4TGAQZy7zZMPcoDjbeHRcgvdxu0e9nvX4s8kOjJJ0R0Y92SOaxIYFNTla0OGacGYiob/sr5cg0Y/v2tj26gJJWEhFXoC4LqRBCk734AKcplBcNeU0vFIQTg+D6NXSS6t/9IIPGPxXHRwD6ygRYf+1dhTHZqlIipXU2AQAT9VM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738631902; c=relaxed/simple; bh=U5xUI/dJojXi8jaM2KImFDgZC+wj5t9cCLBkF+tjfyk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bUiwgmj1MTpbAm16faT/yOhUYQ0QVjVmhSigvUVRnOUqdUpqNQ7aDpsDtttkRV+NU4iHYg13UCwnVBjkhQhi7Ci33KKoOYCcdT2yui8sa2u5dq6p/yHQZF1NKZEPy3/1pgMqYSrk79wWb9jR+fLP815cVVmOijgpUe3HLuzTn8o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WYYxhxlO; 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="WYYxhxlO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07111C4CEE4; Tue, 4 Feb 2025 01:18:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738631901; bh=U5xUI/dJojXi8jaM2KImFDgZC+wj5t9cCLBkF+tjfyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WYYxhxlOfUywj2xuh1uK4hv6DCdF8oXEyNLRJoaSKUWLK26CgH8IAOYQIqDAhOuSo zmcHne65owWgp9jRXcnLEA3xOIMAM8D52X/Koh/mDBgeDVpHOLMawB1vvSkOeQtKTo SH43Yhw24w+sg9xq/p0NNAlOUbPJCxFxbqtwtHbb7sXWlEBQtzIUv42ZagBy6wkvnv yOOr5dyKdJckDV/gdLiwYb+p8SOoKha2e2t0HpFI7B2u6t4h3ExD5dXuyE6yglPZer W121pGriR72SJBoCndtFBpuC/+xs9k29WsJUsWiUwelJYU4uasDfwUqqf/RBf8pGVy t5rr/wKyudwew== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mike Marshall , syzbot+fc519d7875f2d9186c1f@syzkaller.appspotmail.com, Sasha Levin , devel@lists.orangefs.org Subject: [PATCH AUTOSEL 6.6 2/3] orangefs: fix a oob in orangefs_debug_write Date: Mon, 3 Feb 2025 20:18:10 -0500 Message-Id: <20250204011814.2207014-2-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250204011814.2207014-1-sashal@kernel.org> References: <20250204011814.2207014-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.6.75 Content-Transfer-Encoding: 8bit From: Mike Marshall [ Upstream commit f7c848431632598ff9bce57a659db6af60d75b39 ] I got a syzbot report: slab-out-of-bounds Read in orangefs_debug_write... several people suggested fixes, I tested Al Viro's suggestion and made this patch. Signed-off-by: Mike Marshall Reported-by: syzbot+fc519d7875f2d9186c1f@syzkaller.appspotmail.com Signed-off-by: Sasha Levin --- fs/orangefs/orangefs-debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/orangefs/orangefs-debugfs.c b/fs/orangefs/orangefs-debugfs.c index 1b508f5433846..fa41db0884880 100644 --- a/fs/orangefs/orangefs-debugfs.c +++ b/fs/orangefs/orangefs-debugfs.c @@ -393,9 +393,9 @@ static ssize_t orangefs_debug_write(struct file *file, * Thwart users who try to jamb a ridiculous number * of bytes into the debug file... */ - if (count > ORANGEFS_MAX_DEBUG_STRING_LEN + 1) { + if (count > ORANGEFS_MAX_DEBUG_STRING_LEN) { silly = count; - count = ORANGEFS_MAX_DEBUG_STRING_LEN + 1; + count = ORANGEFS_MAX_DEBUG_STRING_LEN; } buf = kzalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL); -- 2.39.5