Skip to content

Commit

Permalink
kmsg: /dev/kmsg - properly return possible copy_from_user() failure
Browse files Browse the repository at this point in the history
Reported-by: Andrew Morton <[email protected]>
Signed-off-by: Kay Sievers <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
kaysievers authored and torvalds committed Jul 31, 2012
1 parent 5353cf0 commit cdf5344
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kernel/printk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit cdf5344

Please sign in to comment.