Skip to content

Commit 3d15f4c

Browse files
Lizhi Xugregkh
authored andcommitted
tracing: Prevent bad count for tracing_cpumask_write
commit 98feccbf32cfdde8c722bc4587aaa60ee5ac33f0 upstream. If a large count is provided, it will trigger a warning in bitmap_parse_user. Also check zero for it. Cc: [email protected] Fixes: 9e01c1b ("cpumask: convert kernel trace functions") Link: https://lore.kernel.org/[email protected] Reported-by: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=0aecfd34fb878546f3fd Tested-by: [email protected] Signed-off-by: Lizhi Xu <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f2a16d2 commit 3d15f4c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/trace/trace.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5262,6 +5262,9 @@ tracing_cpumask_write(struct file *filp, const char __user *ubuf,
52625262
cpumask_var_t tracing_cpumask_new;
52635263
int err;
52645264

5265+
if (count == 0 || count > KMALLOC_MAX_SIZE)
5266+
return -EINVAL;
5267+
52655268
if (!zalloc_cpumask_var(&tracing_cpumask_new, GFP_KERNEL))
52665269
return -ENOMEM;
52675270

0 commit comments

Comments
 (0)