Skip to content

Commit 98feccb

Browse files
Lizhi Xurostedt
authored andcommitted
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: [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]>
1 parent 452f4b3 commit 98feccb

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
@@ -5087,6 +5087,9 @@ tracing_cpumask_write(struct file *filp, const char __user *ubuf,
50875087
cpumask_var_t tracing_cpumask_new;
50885088
int err;
50895089

5090+
if (count == 0 || count > KMALLOC_MAX_SIZE)
5091+
return -EINVAL;
5092+
50905093
if (!zalloc_cpumask_var(&tracing_cpumask_new, GFP_KERNEL))
50915094
return -ENOMEM;
50925095

0 commit comments

Comments
 (0)