diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2017-09-21 03:21:22 +0300 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-12-03 04:38:09 +0300 |
commit | d63d271ce2b5ce6b4efeefd817b60e6a758083a5 (patch) | |
tree | b90d29fb28304c793c217ce931fa206906df853d /net/smc/smc_clc.c | |
parent | 7edffd25be336ecc9e82d36ef53f5c9ab552e01f (diff) | |
download | linux-d63d271ce2b5ce6b4efeefd817b60e6a758083a5.tar.xz |
smc: switch to sock_recvmsg()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net/smc/smc_clc.c')
-rw-r--r-- | net/smc/smc_clc.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c index 1800e16b2a02..511548085d16 100644 --- a/net/smc/smc_clc.c +++ b/net/smc/smc_clc.c @@ -35,7 +35,7 @@ int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen, struct smc_clc_msg_hdr *clcm = buf; struct msghdr msg = {NULL, 0}; int reason_code = 0; - struct kvec vec; + struct kvec vec = {buf, buflen}; int len, datlen; int krflags; @@ -43,12 +43,15 @@ int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen, * so we don't consume any subsequent CLC message or payload data * in the TCP byte stream */ - vec.iov_base = buf; - vec.iov_len = buflen; + /* + * Caller must make sure that buflen is no less than + * sizeof(struct smc_clc_msg_hdr) + */ krflags = MSG_PEEK | MSG_WAITALL; smc->clcsock->sk->sk_rcvtimeo = CLC_WAIT_TIME; - len = kernel_recvmsg(smc->clcsock, &msg, &vec, 1, - sizeof(struct smc_clc_msg_hdr), krflags); + iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, &vec, 1, + sizeof(struct smc_clc_msg_hdr)); + len = sock_recvmsg(smc->clcsock, &msg, krflags); if (signal_pending(current)) { reason_code = -EINTR; clc_sk->sk_err = EINTR; @@ -83,12 +86,11 @@ int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen, } /* receive the complete CLC message */ - vec.iov_base = buf; - vec.iov_len = buflen; memset(&msg, 0, sizeof(struct msghdr)); + iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, &vec, 1, buflen); krflags = MSG_WAITALL; smc->clcsock->sk->sk_rcvtimeo = CLC_WAIT_TIME; - len = kernel_recvmsg(smc->clcsock, &msg, &vec, 1, datlen, krflags); + len = sock_recvmsg(smc->clcsock, &msg, krflags); if (len < datlen) { smc->sk.sk_err = EPROTO; reason_code = -EPROTO; |