]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kmsg: /dev/kmsg - properly return possible copy_from_user() failure
authorKay Sievers <kay@vrfy.org>
Sat, 21 Jul 2012 00:54:41 +0000 (10:54 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 25 Jul 2012 03:53:12 +0000 (13:53 +1000)
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>
kernel/printk.c

index 50c96b5651b696766c915b57dec92b5629a78866..852269adad25afc878c3f10e7a3bf059d086cca9 100644 (file)
@@ -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;
        }