Skip to content

Commit 1cca920

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: stable@vger.kernel.org Fixes: 9e01c1b ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a744146 commit 1cca920

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

kernel/trace/trace.c

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

5114+
if (count == 0 || count > KMALLOC_MAX_SIZE)
5115+
return -EINVAL;
5116+
51145117
if (!zalloc_cpumask_var(&tracing_cpumask_new, GFP_KERNEL))
51155118
return -ENOMEM;
51165119

0 commit comments

Comments
 (0)