summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLizhi Xu <lizhi.xu@windriver.com>2024-12-16 08:32:38 +0100
committerSteven Rostedt (Google) <rostedt@goodmis.org>2024-12-24 03:59:15 +0100
commit98feccbf32cfdde8c722bc4587aaa60ee5ac33f0 (patch)
tree9ed8e0d488b03c81e35c9b68ca4d60a16e80b3ec /kernel
parenttracing: Constify string literal data member in struct trace_event_call (diff)
downloadlinux-98feccbf32cfdde8c722bc4587aaa60ee5ac33f0.tar.xz
linux-98feccbf32cfdde8c722bc4587aaa60ee5ac33f0.zip
tracing: Prevent bad count for tracing_cpumask_write
If a large count is provided, it will trigger a warning in bitmap_parse_user. Also check zero for it. Cc: stable@vger.kernel.org Fixes: 9e01c1b74c953 ("cpumask: convert kernel trace functions") Link: https://lore.kernel.org/20241216073238.2573704-1-lizhi.xu@windriver.com Reported-by: syzbot+0aecfd34fb878546f3fd@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=0aecfd34fb878546f3fd Tested-by: syzbot+0aecfd34fb878546f3fd@syzkaller.appspotmail.com Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 957f941a08e7..f8aebcb01e62 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -5087,6 +5087,9 @@ tracing_cpumask_write(struct file *filp, const char __user *ubuf,
cpumask_var_t tracing_cpumask_new;
int err;
+ if (count == 0 || count > KMALLOC_MAX_SIZE)
+ return -EINVAL;
+
if (!zalloc_cpumask_var(&tracing_cpumask_new, GFP_KERNEL))
return -ENOMEM;