summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorMike Marshall <hubcap@omnibond.com>2025-01-08 14:21:08 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-02-21 13:57:12 +0100
commit2b84a231910cef2e0a16d29294afabfb69112087 (patch)
treec1ba7dc18c26f1a409cd288184d803b52887f63b /fs
parenta04fe3bfc71e28009e20357b79df1e8ef7c9d600 (diff)
downloadlinux-2b84a231910cef2e0a16d29294afabfb69112087.tar.gz
linux-2b84a231910cef2e0a16d29294afabfb69112087.tar.bz2
linux-2b84a231910cef2e0a16d29294afabfb69112087.zip
orangefs: fix a oob in orangefs_debug_write
[ 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 <hubcap@omnibond.com> Reported-by: syzbot+fc519d7875f2d9186c1f@syzkaller.appspotmail.com Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/orangefs/orangefs-debugfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/orangefs/orangefs-debugfs.c b/fs/orangefs/orangefs-debugfs.c
index 1b508f543384..fa41db088488 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);