aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/msg.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-11-28 15:52:29 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2015-02-04 01:34:15 -0500
commitf25dcc7687d42a72de18aa41b04990a24c9e77c7 (patch)
tree37b428117d042baa6cd67333bd9fdf567f85ef47 /net/tipc/msg.c
parent21226abb4e9f14d88238964d89b279e461ddc30c (diff)
tipc: tipc ->sendmsg() conversion
This one needs to copy the same data from user potentially more than once. Sadly, MTU changes can trigger that ;-/ Cc: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net/tipc/msg.c')
-rw-r--r--net/tipc/msg.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index 18aba9e99345..da67c8d3edc6 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -189,7 +189,6 @@ err:
189 * tipc_msg_build - create buffer chain containing specified header and data 189 * tipc_msg_build - create buffer chain containing specified header and data
190 * @mhdr: Message header, to be prepended to data 190 * @mhdr: Message header, to be prepended to data
191 * @m: User message 191 * @m: User message
192 * @offset: Posision in iov to start copying from
193 * @dsz: Total length of user data 192 * @dsz: Total length of user data
194 * @pktmax: Max packet size that can be used 193 * @pktmax: Max packet size that can be used
195 * @list: Buffer or chain of buffers to be returned to caller 194 * @list: Buffer or chain of buffers to be returned to caller
@@ -221,8 +220,7 @@ int tipc_msg_build(struct net *net, struct tipc_msg *mhdr, struct msghdr *m,
221 __skb_queue_tail(list, skb); 220 __skb_queue_tail(list, skb);
222 skb_copy_to_linear_data(skb, mhdr, mhsz); 221 skb_copy_to_linear_data(skb, mhdr, mhsz);
223 pktpos = skb->data + mhsz; 222 pktpos = skb->data + mhsz;
224 if (!dsz || !memcpy_fromiovecend(pktpos, m->msg_iter.iov, offset, 223 if (copy_from_iter(pktpos, dsz, &m->msg_iter) == dsz)
225 dsz))
226 return dsz; 224 return dsz;
227 rc = -EFAULT; 225 rc = -EFAULT;
228 goto error; 226 goto error;
@@ -252,12 +250,11 @@ int tipc_msg_build(struct net *net, struct tipc_msg *mhdr, struct msghdr *m,
252 if (drem < pktrem) 250 if (drem < pktrem)
253 pktrem = drem; 251 pktrem = drem;
254 252
255 if (memcpy_fromiovecend(pktpos, m->msg_iter.iov, offset, pktrem)) { 253 if (copy_from_iter(pktpos, pktrem, &m->msg_iter) != pktrem) {
256 rc = -EFAULT; 254 rc = -EFAULT;
257 goto error; 255 goto error;
258 } 256 }
259 drem -= pktrem; 257 drem -= pktrem;
260 offset += pktrem;
261 258
262 if (!drem) 259 if (!drem)
263 break; 260 break;