aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-02 14:18:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-02 14:18:50 -0400
commit5b13475a5e12c49c24422ba1bd9998521dec1d4e (patch)
tree41051b43641e7649f0074c9565bf4a0a512bab6d /net
parent6fd4e7f7744bd7859ca3cae19c4613252ebb6bff (diff)
parenta6a5993243550b09f620941dea741b7421fdf79c (diff)
Merge branch 'work.iov_iter' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull iov_iter updates from Al Viro: "Cleanups that sat in -next + -stable fodder that has just missed 4.11. There's more iov_iter work in my local tree, but I'd prefer to push the stuff that had been in -next first" * 'work.iov_iter' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: iov_iter: don't revert iov buffer if csum error generic_file_read_iter(): make use of iov_iter_revert() generic_file_direct_write(): make use of iov_iter_revert() orangefs: use iov_iter_revert() sctp: switch to copy_from_iter_full() net/9p: switch to copy_from_iter_full() switch memcpy_from_msg() to copy_from_iter_full() rds: make use of iov_iter_revert()
Diffstat (limited to 'net')
-rw-r--r--net/9p/client.c5
-rw-r--r--net/9p/protocol.c2
-rw-r--r--net/core/datagram.c13
-rw-r--r--net/rds/recv.c4
-rw-r--r--net/sctp/sm_make_chunk.c4
5 files changed, 12 insertions, 16 deletions
diff --git a/net/9p/client.c b/net/9p/client.c
index 8e5c6a8d0a37..1218fb3b52da 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -592,9 +592,8 @@ static int p9_check_zc_errors(struct p9_client *c, struct p9_req_t *req,
592 ename = &req->rc->sdata[req->rc->offset]; 592 ename = &req->rc->sdata[req->rc->offset];
593 if (len > inline_len) { 593 if (len > inline_len) {
594 /* We have error in external buffer */ 594 /* We have error in external buffer */
595 err = copy_from_iter(ename + inline_len, 595 if (!copy_from_iter_full(ename + inline_len,
596 len - inline_len, uidata); 596 len - inline_len, uidata)) {
597 if (err != len - inline_len) {
598 err = -EFAULT; 597 err = -EFAULT;
599 goto out_err; 598 goto out_err;
600 } 599 }
diff --git a/net/9p/protocol.c b/net/9p/protocol.c
index 16d287565987..16e10680518c 100644
--- a/net/9p/protocol.c
+++ b/net/9p/protocol.c
@@ -74,7 +74,7 @@ pdu_write_u(struct p9_fcall *pdu, struct iov_iter *from, size_t size)
74{ 74{
75 size_t len = min(pdu->capacity - pdu->size, size); 75 size_t len = min(pdu->capacity - pdu->size, size);
76 struct iov_iter i = *from; 76 struct iov_iter i = *from;
77 if (copy_from_iter(&pdu->sdata[pdu->size], len, &i) != len) 77 if (!copy_from_iter_full(&pdu->sdata[pdu->size], len, &i))
78 len = 0; 78 len = 0;
79 79
80 pdu->size += len; 80 pdu->size += len;
diff --git a/net/core/datagram.c b/net/core/datagram.c
index f4947e737f34..d797baa69e43 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -760,7 +760,7 @@ int skb_copy_and_csum_datagram_msg(struct sk_buff *skb,
760 760
761 if (msg_data_left(msg) < chunk) { 761 if (msg_data_left(msg) < chunk) {
762 if (__skb_checksum_complete(skb)) 762 if (__skb_checksum_complete(skb))
763 goto csum_error; 763 return -EINVAL;
764 if (skb_copy_datagram_msg(skb, hlen, msg, chunk)) 764 if (skb_copy_datagram_msg(skb, hlen, msg, chunk))
765 goto fault; 765 goto fault;
766 } else { 766 } else {
@@ -768,15 +768,16 @@ int skb_copy_and_csum_datagram_msg(struct sk_buff *skb,
768 if (skb_copy_and_csum_datagram(skb, hlen, &msg->msg_iter, 768 if (skb_copy_and_csum_datagram(skb, hlen, &msg->msg_iter,
769 chunk, &csum)) 769 chunk, &csum))
770 goto fault; 770 goto fault;
771 if (csum_fold(csum)) 771
772 goto csum_error; 772 if (csum_fold(csum)) {
773 iov_iter_revert(&msg->msg_iter, chunk);
774 return -EINVAL;
775 }
776
773 if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE)) 777 if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE))
774 netdev_rx_csum_fault(skb->dev); 778 netdev_rx_csum_fault(skb->dev);
775 } 779 }
776 return 0; 780 return 0;
777csum_error:
778 iov_iter_revert(&msg->msg_iter, chunk);
779 return -EINVAL;
780fault: 781fault:
781 return -EFAULT; 782 return -EFAULT;
782} 783}
diff --git a/net/rds/recv.c b/net/rds/recv.c
index 8b7e7b7f2c2d..c70c32cb05f5 100644
--- a/net/rds/recv.c
+++ b/net/rds/recv.c
@@ -594,7 +594,6 @@ int rds_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
594 goto out; 594 goto out;
595 595
596 while (1) { 596 while (1) {
597 struct iov_iter save;
598 /* If there are pending notifications, do those - and nothing else */ 597 /* If there are pending notifications, do those - and nothing else */
599 if (!list_empty(&rs->rs_notify_queue)) { 598 if (!list_empty(&rs->rs_notify_queue)) {
600 ret = rds_notify_queue_get(rs, msg); 599 ret = rds_notify_queue_get(rs, msg);
@@ -630,7 +629,6 @@ int rds_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
630 rdsdebug("copying inc %p from %pI4:%u to user\n", inc, 629 rdsdebug("copying inc %p from %pI4:%u to user\n", inc,
631 &inc->i_conn->c_faddr, 630 &inc->i_conn->c_faddr,
632 ntohs(inc->i_hdr.h_sport)); 631 ntohs(inc->i_hdr.h_sport));
633 save = msg->msg_iter;
634 ret = inc->i_conn->c_trans->inc_copy_to_user(inc, &msg->msg_iter); 632 ret = inc->i_conn->c_trans->inc_copy_to_user(inc, &msg->msg_iter);
635 if (ret < 0) 633 if (ret < 0)
636 break; 634 break;
@@ -644,7 +642,7 @@ int rds_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
644 rds_inc_put(inc); 642 rds_inc_put(inc);
645 inc = NULL; 643 inc = NULL;
646 rds_stats_inc(s_recv_deliver_raced); 644 rds_stats_inc(s_recv_deliver_raced);
647 msg->msg_iter = save; 645 iov_iter_revert(&msg->msg_iter, ret);
648 continue; 646 continue;
649 } 647 }
650 648
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 118faff6a332..8a08f13469c4 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1512,14 +1512,12 @@ int sctp_user_addto_chunk(struct sctp_chunk *chunk, int len,
1512 struct iov_iter *from) 1512 struct iov_iter *from)
1513{ 1513{
1514 void *target; 1514 void *target;
1515 ssize_t copied;
1516 1515
1517 /* Make room in chunk for data. */ 1516 /* Make room in chunk for data. */
1518 target = skb_put(chunk->skb, len); 1517 target = skb_put(chunk->skb, len);
1519 1518
1520 /* Copy data (whole iovec) into chunk */ 1519 /* Copy data (whole iovec) into chunk */
1521 copied = copy_from_iter(target, len, from); 1520 if (!copy_from_iter_full(target, len, from))
1522 if (copied != len)
1523 return -EFAULT; 1521 return -EFAULT;
1524 1522
1525 /* Adjust the chunk length field. */ 1523 /* Adjust the chunk length field. */