summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2012-07-30 14:40:08 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-30 17:25:13 -0700
commitcdf53441368cc02ee4aa8a8343a5dc25132836f0 (patch)
tree3867dc7e3a4477f7d2ed9ed5990b6d71f075c0d2
parent5353cf089bb32b69a7515be909c14bf05fe2e81e (diff)
downloadop-kernel-dev-cdf53441368cc02ee4aa8a8343a5dc25132836f0.zip
op-kernel-dev-cdf53441368cc02ee4aa8a8343a5dc25132836f0.tar.gz
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>
-rw-r--r--kernel/printk.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/printk.c b/kernel/printk.c
index 50c96b5..852269a 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;
}
OpenPOWER on IntegriCloud