Message ID | 20241216073238.2573704-1-lizhi.xu@windriver.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [V2] tracing: Prevent bad count for tracing_cpumask_write | expand |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index be62f0ea1814..109f301549b8 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -5225,6 +5225,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;