Skip to content

Commit

Permalink
net/smc: use announced length in sock_recvmsg()
Browse files Browse the repository at this point in the history
Not every CLC proposal message needs the maximum buffer length.
Due to the MSG_WAITALL flag, it is important to use the peeked
real length when receiving the message.

Fixes: d63d271 ("smc: switch to sock_recvmsg()")
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ursula Braun authored and David S. Miller committed Mar 27, 2018
1 parent b85ab56 commit ab6f6dd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/smc/smc_clc.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen,

/* receive the complete CLC message */
memset(&msg, 0, sizeof(struct msghdr));
iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, &vec, 1, buflen);
iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, &vec, 1, datlen);
krflags = MSG_WAITALL;
smc->clcsock->sk->sk_rcvtimeo = CLC_WAIT_TIME;
len = sock_recvmsg(smc->clcsock, &msg, krflags);
Expand Down

0 comments on commit ab6f6dd

Please sign in to comment.