diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-11-24 10:42:55 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-12-09 16:29:03 -0500 |
commit | c0371da6047abd261bc483c744dbc7d81a116172 (patch) | |
tree | 73b4d685f311a83e04f3a684ce18225b409b3f5f /net/compat.c | |
parent | d838df2e5dcbb6ed4d82854869e9a30f9aeef6da (diff) |
put iov_iter into msghdr
Note that the code _using_ ->msg_iter at that point will be very
unhappy with anything other than unshifted iovec-backed iov_iter.
We still need to convert users to proper primitives.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net/compat.c')
-rw-r--r-- | net/compat.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/net/compat.c b/net/compat.c index 062f157d2a6b..3236b4167a32 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -37,13 +37,14 @@ ssize_t get_compat_msghdr(struct msghdr *kmsg, | |||
37 | struct iovec **iov) | 37 | struct iovec **iov) |
38 | { | 38 | { |
39 | compat_uptr_t uaddr, uiov, tmp3; | 39 | compat_uptr_t uaddr, uiov, tmp3; |
40 | compat_size_t nr_segs; | ||
40 | ssize_t err; | 41 | ssize_t err; |
41 | 42 | ||
42 | if (!access_ok(VERIFY_READ, umsg, sizeof(*umsg)) || | 43 | if (!access_ok(VERIFY_READ, umsg, sizeof(*umsg)) || |
43 | __get_user(uaddr, &umsg->msg_name) || | 44 | __get_user(uaddr, &umsg->msg_name) || |
44 | __get_user(kmsg->msg_namelen, &umsg->msg_namelen) || | 45 | __get_user(kmsg->msg_namelen, &umsg->msg_namelen) || |
45 | __get_user(uiov, &umsg->msg_iov) || | 46 | __get_user(uiov, &umsg->msg_iov) || |
46 | __get_user(kmsg->msg_iovlen, &umsg->msg_iovlen) || | 47 | __get_user(nr_segs, &umsg->msg_iovlen) || |
47 | __get_user(tmp3, &umsg->msg_control) || | 48 | __get_user(tmp3, &umsg->msg_control) || |
48 | __get_user(kmsg->msg_controllen, &umsg->msg_controllen) || | 49 | __get_user(kmsg->msg_controllen, &umsg->msg_controllen) || |
49 | __get_user(kmsg->msg_flags, &umsg->msg_flags)) | 50 | __get_user(kmsg->msg_flags, &umsg->msg_flags)) |
@@ -68,14 +69,15 @@ ssize_t get_compat_msghdr(struct msghdr *kmsg, | |||
68 | kmsg->msg_namelen = 0; | 69 | kmsg->msg_namelen = 0; |
69 | } | 70 | } |
70 | 71 | ||
71 | if (kmsg->msg_iovlen > UIO_MAXIOV) | 72 | if (nr_segs > UIO_MAXIOV) |
72 | return -EMSGSIZE; | 73 | return -EMSGSIZE; |
73 | 74 | ||
74 | err = compat_rw_copy_check_uvector(save_addr ? READ : WRITE, | 75 | err = compat_rw_copy_check_uvector(save_addr ? READ : WRITE, |
75 | compat_ptr(uiov), kmsg->msg_iovlen, | 76 | compat_ptr(uiov), nr_segs, |
76 | UIO_FASTIOV, *iov, iov); | 77 | UIO_FASTIOV, *iov, iov); |
77 | if (err >= 0) | 78 | if (err >= 0) |
78 | kmsg->msg_iov = *iov; | 79 | iov_iter_init(&kmsg->msg_iter, save_addr ? READ : WRITE, |
80 | *iov, nr_segs, err); | ||
79 | return err; | 81 | return err; |
80 | } | 82 | } |
81 | 83 | ||