diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2017-09-20 20:11:00 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-12-02 20:38:07 -0500 |
commit | 956a27ecfad51048c7614ec256c638f166bd8db3 (patch) | |
tree | b06b008cc780afa92df0053d06c078f5af70309c | |
parent | f7765c364684085efeb81727757a52f2e1d20482 (diff) |
mISDN: switch to sock_recvmsg()
here we do need to reinitialize ->msg_iter on each call - the
data in buffer is overwritten every time, not appended to.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | drivers/isdn/mISDN/l1oip_core.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/isdn/mISDN/l1oip_core.c b/drivers/isdn/mISDN/l1oip_core.c index e3654782a3e2..21d50e4cc5e1 100644 --- a/drivers/isdn/mISDN/l1oip_core.c +++ b/drivers/isdn/mISDN/l1oip_core.c @@ -645,8 +645,10 @@ l1oip_socket_thread(void *data) { struct l1oip *hc = (struct l1oip *)data; int ret = 0; - struct msghdr msg; struct sockaddr_in sin_rx; + struct kvec iov; + struct msghdr msg = {.msg_name = &sin_rx, + .msg_namelen = sizeof(sin_rx)}; unsigned char *recvbuf; size_t recvbuf_size = 1500; int recvlen; @@ -661,6 +663,9 @@ l1oip_socket_thread(void *data) goto fail; } + iov.iov_base = recvbuf; + iov.iov_len = recvbuf_size; + /* make daemon */ allow_signal(SIGTERM); @@ -697,12 +702,6 @@ l1oip_socket_thread(void *data) goto fail; } - /* build receive message */ - msg.msg_name = &sin_rx; - msg.msg_namelen = sizeof(sin_rx); - msg.msg_control = NULL; - msg.msg_controllen = 0; - /* build send message */ hc->sendmsg.msg_name = &hc->sin_remote; hc->sendmsg.msg_namelen = sizeof(hc->sin_remote); @@ -719,12 +718,9 @@ l1oip_socket_thread(void *data) printk(KERN_DEBUG "%s: socket created and open\n", __func__); while (!signal_pending(current)) { - struct kvec iov = { - .iov_base = recvbuf, - .iov_len = recvbuf_size, - }; - recvlen = kernel_recvmsg(socket, &msg, &iov, 1, - recvbuf_size, 0); + iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, &iov, 1, + recvbuf_size); + recvlen = sock_recvmsg(socket, &msg, 0); if (recvlen > 0) { l1oip_socket_parse(hc, &sin_rx, recvbuf, recvlen); } else { |