mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
printk: return -EINVAL if the message len is bigger than the buf size
Just like what devkmsg_read() does, return -EINVAL if the message len is bigger than the buf size, or it will trigger a segfault error. Acked-by: Kay Sievers <[email protected]> Acked-by: Fengguang Wu <[email protected]> Signed-off-by: Yuanhan Liu <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
4a77a5a06e
commit
b56a39ac26
1 changed files with 3 additions and 1 deletions
|
|
@ -880,7 +880,9 @@ static int syslog_print(char __user *buf, int size)
|
|||
syslog_seq++;
|
||||
raw_spin_unlock_irq(&logbuf_lock);
|
||||
|
||||
if (len > 0 && copy_to_user(buf, text, len))
|
||||
if (len > size)
|
||||
len = -EINVAL;
|
||||
else if (len > 0 && copy_to_user(buf, text, len))
|
||||
len = -EFAULT;
|
||||
|
||||
kfree(text);
|
||||
|
|
|
|||
Loading…
Reference in a new issue