aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-11-24 10:42:55 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2014-12-09 16:29:03 -0500
commitc0371da6047abd261bc483c744dbc7d81a116172 (patch)
tree73b4d685f311a83e04f3a684ce18225b409b3f5f /drivers/net/tun.c
parentd838df2e5dcbb6ed4d82854869e9a30f9aeef6da (diff)
put iov_iter into msghdr
Note that the code _using_ ->msg_iter at that point will be very unhappy with anything other than unshifted iovec-backed iov_iter. We still need to convert users to proper primitives. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 9c58286b8a42..f3e992ed87ac 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1449,13 +1449,11 @@ static int tun_sendmsg(struct kiocb *iocb, struct socket *sock,
1449 int ret; 1449 int ret;
1450 struct tun_file *tfile = container_of(sock, struct tun_file, socket); 1450 struct tun_file *tfile = container_of(sock, struct tun_file, socket);
1451 struct tun_struct *tun = __tun_get(tfile); 1451 struct tun_struct *tun = __tun_get(tfile);
1452 struct iov_iter from;
1453 1452
1454 if (!tun) 1453 if (!tun)
1455 return -EBADFD; 1454 return -EBADFD;
1456 1455
1457 iov_iter_init(&from, WRITE, m->msg_iov, m->msg_iovlen, total_len); 1456 ret = tun_get_user(tun, tfile, m->msg_control, &m->msg_iter,
1458 ret = tun_get_user(tun, tfile, m->msg_control, &from,
1459 m->msg_flags & MSG_DONTWAIT); 1457 m->msg_flags & MSG_DONTWAIT);
1460 tun_put(tun); 1458 tun_put(tun);
1461 return ret; 1459 return ret;
@@ -1467,7 +1465,6 @@ static int tun_recvmsg(struct kiocb *iocb, struct socket *sock,
1467{ 1465{
1468 struct tun_file *tfile = container_of(sock, struct tun_file, socket); 1466 struct tun_file *tfile = container_of(sock, struct tun_file, socket);
1469 struct tun_struct *tun = __tun_get(tfile); 1467 struct tun_struct *tun = __tun_get(tfile);
1470 struct iov_iter to;
1471 int ret; 1468 int ret;
1472 1469
1473 if (!tun) 1470 if (!tun)
@@ -1482,8 +1479,7 @@ static int tun_recvmsg(struct kiocb *iocb, struct socket *sock,
1482 SOL_PACKET, TUN_TX_TIMESTAMP); 1479 SOL_PACKET, TUN_TX_TIMESTAMP);
1483 goto out; 1480 goto out;
1484 } 1481 }
1485 iov_iter_init(&to, READ, m->msg_iov, m->msg_iovlen, total_len); 1482 ret = tun_do_read(tun, tfile, &m->msg_iter, flags & MSG_DONTWAIT);
1486 ret = tun_do_read(tun, tfile, &to, flags & MSG_DONTWAIT);
1487 if (ret > total_len) { 1483 if (ret > total_len) {
1488 m->msg_flags |= MSG_TRUNC; 1484 m->msg_flags |= MSG_TRUNC;
1489 ret = flags & MSG_TRUNC ? ret : total_len; 1485 ret = flags & MSG_TRUNC ? ret : total_len;