@@ -35,20 +35,23 @@ int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen,
35
35
struct smc_clc_msg_hdr * clcm = buf ;
36
36
struct msghdr msg = {NULL , 0 };
37
37
int reason_code = 0 ;
38
- struct kvec vec ;
38
+ struct kvec vec = { buf , buflen } ;
39
39
int len , datlen ;
40
40
int krflags ;
41
41
42
42
/* peek the first few bytes to determine length of data to receive
43
43
* so we don't consume any subsequent CLC message or payload data
44
44
* in the TCP byte stream
45
45
*/
46
- vec .iov_base = buf ;
47
- vec .iov_len = buflen ;
46
+ /*
47
+ * Caller must make sure that buflen is no less than
48
+ * sizeof(struct smc_clc_msg_hdr)
49
+ */
48
50
krflags = MSG_PEEK | MSG_WAITALL ;
49
51
smc -> clcsock -> sk -> sk_rcvtimeo = CLC_WAIT_TIME ;
50
- len = kernel_recvmsg (smc -> clcsock , & msg , & vec , 1 ,
51
- sizeof (struct smc_clc_msg_hdr ), krflags );
52
+ iov_iter_kvec (& msg .msg_iter , READ | ITER_KVEC , & vec , 1 ,
53
+ sizeof (struct smc_clc_msg_hdr ));
54
+ len = sock_recvmsg (smc -> clcsock , & msg , krflags );
52
55
if (signal_pending (current )) {
53
56
reason_code = - EINTR ;
54
57
clc_sk -> sk_err = EINTR ;
@@ -83,12 +86,11 @@ int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen,
83
86
}
84
87
85
88
/* receive the complete CLC message */
86
- vec .iov_base = buf ;
87
- vec .iov_len = buflen ;
88
89
memset (& msg , 0 , sizeof (struct msghdr ));
90
+ iov_iter_kvec (& msg .msg_iter , READ | ITER_KVEC , & vec , 1 , buflen );
89
91
krflags = MSG_WAITALL ;
90
92
smc -> clcsock -> sk -> sk_rcvtimeo = CLC_WAIT_TIME ;
91
- len = kernel_recvmsg (smc -> clcsock , & msg , & vec , 1 , datlen , krflags );
93
+ len = sock_recvmsg (smc -> clcsock , & msg , krflags );
92
94
if (len < datlen ) {
93
95
smc -> sk .sk_err = EPROTO ;
94
96
reason_code = - EPROTO ;
0 commit comments