diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-11-06 01:10:59 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-11-24 05:16:39 -0500 |
commit | 8feb2fb2bb986c533e18037d3c45a5f779421992 (patch) | |
tree | 7c10e24137e82d54aaa533aeadc21a2d2dae922c /net/packet | |
parent | 195e952d03a797aa953f62ffe24ec58693e17ed8 (diff) |
switch AF_PACKET and AF_UNIX to skb_copy_datagram_from_iter()
... and kill skb_copy_datagram_iovec()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net/packet')
-rw-r--r-- | net/packet/af_packet.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 108d7f381b87..dfb148e9fdaa 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -2408,6 +2408,10 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) | |||
2408 | unsigned short gso_type = 0; | 2408 | unsigned short gso_type = 0; |
2409 | int hlen, tlen; | 2409 | int hlen, tlen; |
2410 | int extra_len = 0; | 2410 | int extra_len = 0; |
2411 | struct iov_iter from; | ||
2412 | ssize_t n; | ||
2413 | |||
2414 | iov_iter_init(&from, WRITE, msg->msg_iov, msg->msg_iovlen, len); | ||
2411 | 2415 | ||
2412 | /* | 2416 | /* |
2413 | * Get and verify the address. | 2417 | * Get and verify the address. |
@@ -2446,8 +2450,9 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) | |||
2446 | 2450 | ||
2447 | len -= vnet_hdr_len; | 2451 | len -= vnet_hdr_len; |
2448 | 2452 | ||
2449 | err = memcpy_from_msg((void *)&vnet_hdr, msg, vnet_hdr_len); | 2453 | err = -EFAULT; |
2450 | if (err < 0) | 2454 | n = copy_from_iter(&vnet_hdr, vnet_hdr_len, &from); |
2455 | if (n != vnet_hdr_len) | ||
2451 | goto out_unlock; | 2456 | goto out_unlock; |
2452 | 2457 | ||
2453 | if ((vnet_hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) && | 2458 | if ((vnet_hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) && |
@@ -2517,7 +2522,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) | |||
2517 | } | 2522 | } |
2518 | 2523 | ||
2519 | /* Returns -EFAULT on error */ | 2524 | /* Returns -EFAULT on error */ |
2520 | err = skb_copy_datagram_from_iovec(skb, offset, msg->msg_iov, 0, len); | 2525 | err = skb_copy_datagram_from_iter(skb, offset, &from, len); |
2521 | if (err) | 2526 | if (err) |
2522 | goto out_free; | 2527 | goto out_free; |
2523 | 2528 | ||