aboutsummaryrefslogtreecommitdiffstats
path: root/net/rds
diff options
context:
space:
mode:
Diffstat (limited to 'net/rds')
-rw-r--r--net/rds/recv.c7
-rw-r--r--net/rds/send.c4
2 files changed, 5 insertions, 6 deletions
diff --git a/net/rds/recv.c b/net/rds/recv.c
index 47d7b1029b33..f9ec1acd801c 100644
--- a/net/rds/recv.c
+++ b/net/rds/recv.c
@@ -404,7 +404,6 @@ int rds_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
404 int ret = 0, nonblock = msg_flags & MSG_DONTWAIT; 404 int ret = 0, nonblock = msg_flags & MSG_DONTWAIT;
405 DECLARE_SOCKADDR(struct sockaddr_in *, sin, msg->msg_name); 405 DECLARE_SOCKADDR(struct sockaddr_in *, sin, msg->msg_name);
406 struct rds_incoming *inc = NULL; 406 struct rds_incoming *inc = NULL;
407 struct iov_iter to;
408 407
409 /* udp_recvmsg()->sock_recvtimeo() gets away without locking too.. */ 408 /* udp_recvmsg()->sock_recvtimeo() gets away without locking too.. */
410 timeo = sock_rcvtimeo(sk, nonblock); 409 timeo = sock_rcvtimeo(sk, nonblock);
@@ -415,6 +414,7 @@ int rds_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
415 goto out; 414 goto out;
416 415
417 while (1) { 416 while (1) {
417 struct iov_iter save;
418 /* If there are pending notifications, do those - and nothing else */ 418 /* If there are pending notifications, do those - and nothing else */
419 if (!list_empty(&rs->rs_notify_queue)) { 419 if (!list_empty(&rs->rs_notify_queue)) {
420 ret = rds_notify_queue_get(rs, msg); 420 ret = rds_notify_queue_get(rs, msg);
@@ -450,8 +450,8 @@ int rds_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
450 rdsdebug("copying inc %p from %pI4:%u to user\n", inc, 450 rdsdebug("copying inc %p from %pI4:%u to user\n", inc,
451 &inc->i_conn->c_faddr, 451 &inc->i_conn->c_faddr,
452 ntohs(inc->i_hdr.h_sport)); 452 ntohs(inc->i_hdr.h_sport));
453 iov_iter_init(&to, READ, msg->msg_iov, msg->msg_iovlen, size); 453 save = msg->msg_iter;
454 ret = inc->i_conn->c_trans->inc_copy_to_user(inc, &to); 454 ret = inc->i_conn->c_trans->inc_copy_to_user(inc, &msg->msg_iter);
455 if (ret < 0) 455 if (ret < 0)
456 break; 456 break;
457 457
@@ -464,6 +464,7 @@ int rds_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
464 rds_inc_put(inc); 464 rds_inc_put(inc);
465 inc = NULL; 465 inc = NULL;
466 rds_stats_inc(s_recv_deliver_raced); 466 rds_stats_inc(s_recv_deliver_raced);
467 msg->msg_iter = save;
467 continue; 468 continue;
468 } 469 }
469 470
diff --git a/net/rds/send.c b/net/rds/send.c
index 4de62ead1c71..40a5629a0a13 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -934,9 +934,7 @@ int rds_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
934 int queued = 0, allocated_mr = 0; 934 int queued = 0, allocated_mr = 0;
935 int nonblock = msg->msg_flags & MSG_DONTWAIT; 935 int nonblock = msg->msg_flags & MSG_DONTWAIT;
936 long timeo = sock_sndtimeo(sk, nonblock); 936 long timeo = sock_sndtimeo(sk, nonblock);
937 struct iov_iter from;
938 937
939 iov_iter_init(&from, WRITE, msg->msg_iov, msg->msg_iovlen, payload_len);
940 /* Mirror Linux UDP mirror of BSD error message compatibility */ 938 /* Mirror Linux UDP mirror of BSD error message compatibility */
941 /* XXX: Perhaps MSG_MORE someday */ 939 /* XXX: Perhaps MSG_MORE someday */
942 if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_CMSG_COMPAT)) { 940 if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_CMSG_COMPAT)) {
@@ -984,7 +982,7 @@ int rds_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
984 ret = -ENOMEM; 982 ret = -ENOMEM;
985 goto out; 983 goto out;
986 } 984 }
987 ret = rds_message_copy_from_user(rm, &from); 985 ret = rds_message_copy_from_user(rm, &msg->msg_iter);
988 if (ret) 986 if (ret)
989 goto out; 987 goto out;
990 } 988 }