From: Kay Sievers Date: Mon, 30 Jul 2012 21:40:08 +0000 (-0700) Subject: kmsg: /dev/kmsg - properly return possible copy_from_user() failure X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cdf53441368cc02ee4aa8a8343a5dc25132836f0;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git kmsg: /dev/kmsg - properly return possible copy_from_user() failure Reported-by: Andrew Morton Signed-off-by: Kay Sievers Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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; }