projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4a77a5a
)
printk: return -EINVAL if the message len is bigger than the buf size
author
Yuanhan Liu
<
[email protected]
>
Sat, 16 Jun 2012 04:40:55 +0000
(12:40 +0800)
committer
Greg Kroah-Hartman
<
[email protected]
>
Sat, 16 Jun 2012 15:36:03 +0000
(08:36 -0700)
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]
>
kernel/printk.c
patch
|
blob
|
history
diff --git
a/kernel/printk.c
b/kernel/printk.c
index 572730bd8a5ccb6ed33372bcedd3fab9fd024584..a2276b9167691f164c0753d1c3f0d6ff0b7090e9 100644
(file)
--- a/
kernel/printk.c
+++ b/
kernel/printk.c
@@
-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);