summaryrefslogtreecommitdiffstats
path: root/kernel/printk.c
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2012-07-30 23:40:08 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-31 02:25:13 +0200
commitcdf53441368cc02ee4aa8a8343a5dc25132836f0 (patch)
tree3867dc7e3a4477f7d2ed9ed5990b6d71f075c0d2 /kernel/printk.c
parentdrivers/misc/ti-st/st_core.c: missing NULL check (diff)
downloadlinux-cdf53441368cc02ee4aa8a8343a5dc25132836f0.tar.xz
linux-cdf53441368cc02ee4aa8a8343a5dc25132836f0.zip
kmsg: /dev/kmsg - properly return possible copy_from_user() failure
Reported-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Kay Sievers <kay@vrfy.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/printk.c')
-rw-r--r--kernel/printk.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/printk.c b/kernel/printk.c
index 50c96b5651b6..852269adad25 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -389,8 +389,10 @@ static ssize_t devkmsg_writev(struct kiocb *iocb, const struct iovec *iv,
line = buf;
for (i = 0; i < count; i++) {
- if (copy_from_user(line, iv[i].iov_base, iv[i].iov_len))
+ if (copy_from_user(line, iv[i].iov_base, iv[i].iov_len)) {
+ ret = -EFAULT;
goto out;
+ }
line += iv[i].iov_len;
}