Skip to content

Commit 03041e4

Browse files
Lizhi Xugregkh
authored andcommitted
tracing: Prevent bad count for tracing_cpumask_write
commit 98feccb 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 dafa733 commit 03041e4

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
@@ -5331,6 +5331,9 @@ tracing_cpumask_write(struct file *filp, const char __user *ubuf,
53315331
cpumask_var_t tracing_cpumask_new;
53325332
int err;
53335333

5334+
if (count == 0 || count > KMALLOC_MAX_SIZE)
5335+
return -EINVAL;
5336+
53345337
if (!zalloc_cpumask_var(&tracing_cpumask_new, GFP_KERNEL))
53355338
return -ENOMEM;
53365339

0 commit comments

Comments
 (0)