search for: msg_trunc

Displaying 20 results from an estimated 125 matches for "msg_trunc".

2017 Dec 01
6
[PATCH net,stable v3] vhost: fix a few skb leaks
From: Wei Xu <wexu at redhat.com> Matthew found a roughly 40% tcp throughput regression with commit c67df11f(vhost_net: try batch dequing from skb array) as discussed in the following thread: https://www.mail-archive.com/netdev at vger.kernel.org/msg187936.html This is v3. v3: - move freeing skb from vhost to tun/tap recvmsg() to not confuse the callers. v2: - add Matthew as the
2017 Dec 01
6
[PATCH net,stable v3] vhost: fix a few skb leaks
From: Wei Xu <wexu at redhat.com> Matthew found a roughly 40% tcp throughput regression with commit c67df11f(vhost_net: try batch dequing from skb array) as discussed in the following thread: https://www.mail-archive.com/netdev at vger.kernel.org/msg187936.html This is v3. v3: - move freeing skb from vhost to tun/tap recvmsg() to not confuse the callers. v2: - add Matthew as the
2017 Dec 01
9
[PATCH net,stable v4 0/3] vhost: fix a few skb leaks
From: Wei Xu <wexu at redhat.com> Matthew found a roughly 40% tcp throughput regression with commit c67df11f(vhost_net: try batch dequing from skb array) as discussed in the following thread: https://www.mail-archive.com/netdev at vger.kernel.org/msg187936.html v4: - fix zero iov iterator count in tap/tap_do_read()(Jason) - don't put tun in case of EBADFD(Jason) - Replace
2017 Dec 01
9
[PATCH net,stable v4 0/3] vhost: fix a few skb leaks
From: Wei Xu <wexu at redhat.com> Matthew found a roughly 40% tcp throughput regression with commit c67df11f(vhost_net: try batch dequing from skb array) as discussed in the following thread: https://www.mail-archive.com/netdev at vger.kernel.org/msg187936.html v4: - fix zero iov iterator count in tap/tap_do_read()(Jason) - don't put tun in case of EBADFD(Jason) - Replace
2017 Dec 01
1
[PATCH 2/3] tun: free skb in early errors
..., { struct tun_file *tfile = container_of(sock, struct tun_file, socket); struct tun_struct *tun = tun_get(tfile); + struct sk_buff *skb = m->msg_control; int ret; - if (!tun) - return -EBADFD; + if (!tun) { + ret = -EBADFD; + goto out_free_skb; + } if (flags & ~(MSG_DONTWAIT|MSG_TRUNC|MSG_ERRQUEUE)) { ret = -EINVAL; - goto out; + goto out_free_skb; } if (flags & MSG_ERRQUEUE) { ret = sock_recv_errqueue(sock->sk, m, total_len, @@ -2087,6 +2090,11 @@ static int tun_recvmsg(struct socket *sock, struct msghdr *m, size_t total_len, m->msg_flags |= MSG_TRUNC;...
2017 Dec 01
0
[PATCH 3/3] tap: free skb if flags error
...1157,14 @@ static int tap_recvmsg(struct socket *sock, struct msghdr *m, > size_t total_len, int flags) > { > struct tap_queue *q = container_of(sock, struct tap_queue, sock); > + struct sk_buff *skb = m->msg_control; > int ret; > - if (flags & ~(MSG_DONTWAIT|MSG_TRUNC)) > + if (flags & ~(MSG_DONTWAIT|MSG_TRUNC)) { > + if (skb) > + kfree_skb(skb); > return -EINVAL; > - ret = tap_do_read(q, &m->msg_iter, flags & MSG_DONTWAIT, > - m->msg_control); > + } > + ret = tap_do_read(q, &m->msg_iter, flags & MSG...
2017 Dec 01
0
[PATCH 3/3] tap: free skb if flags error
...kb) goto put; @@ -1154,11 +1157,14 @@ static int tap_recvmsg(struct socket *sock, struct msghdr *m, size_t total_len, int flags) { struct tap_queue *q = container_of(sock, struct tap_queue, sock); + struct sk_buff *skb = m->msg_control; int ret; - if (flags & ~(MSG_DONTWAIT|MSG_TRUNC)) + if (flags & ~(MSG_DONTWAIT|MSG_TRUNC)) { + if (skb) + kfree_skb(skb); return -EINVAL; - ret = tap_do_read(q, &m->msg_iter, flags & MSG_DONTWAIT, - m->msg_control); + } + ret = tap_do_read(q, &m->msg_iter, flags & MSG_DONTWAIT, skb); if (ret > total_le...
2017 Nov 29
4
[PATCH net,stable v2] vhost: fix skb leak in handle_rx()
...rx_array) - msg.msg_control = vhost_net_buf_consume(&nvq->rxq); - /* On overrun, truncate and discard */ - if (unlikely(headcount > UIO_MAXIOV)) { - iov_iter_init(&msg.msg_iter, READ, vq->iov, 1, 1); - err = sock->ops->recvmsg(sock, &msg, - 1, MSG_DONTWAIT | MSG_TRUNC); - pr_debug("Discarded rx packet: len %zd\n", sock_len); - continue; - } /* OK, now we need to know about added descriptors. */ if (!headcount) { if (unlikely(vhost_enable_notify(&net->dev, vq))) { @@ -800,6 +790,18 @@ static void handle_rx(struct vhost_net *net)...
2017 Nov 29
4
[PATCH net,stable v2] vhost: fix skb leak in handle_rx()
...rx_array) - msg.msg_control = vhost_net_buf_consume(&nvq->rxq); - /* On overrun, truncate and discard */ - if (unlikely(headcount > UIO_MAXIOV)) { - iov_iter_init(&msg.msg_iter, READ, vq->iov, 1, 1); - err = sock->ops->recvmsg(sock, &msg, - 1, MSG_DONTWAIT | MSG_TRUNC); - pr_debug("Discarded rx packet: len %zd\n", sock_len); - continue; - } /* OK, now we need to know about added descriptors. */ if (!headcount) { if (unlikely(vhost_enable_notify(&net->dev, vq))) { @@ -800,6 +790,18 @@ static void handle_rx(struct vhost_net *net)...
2017 Nov 30
2
[PATCH net,stable v2] vhost: fix skb leak in handle_rx()
..._consume(&nvq->rxq); >> - /* On overrun, truncate and discard */ >> - if (unlikely(headcount > UIO_MAXIOV)) { >> - iov_iter_init(&msg.msg_iter, READ, vq->iov, 1, 1); >> - err = sock->ops->recvmsg(sock, &msg, >> - 1, MSG_DONTWAIT | MSG_TRUNC); >> - pr_debug("Discarded rx packet: len %zd\n", sock_len); >> - continue; >> - } >> /* OK, now we need to know about added descriptors. */ >> if (!headcount) { >> if (unlikely(vhost_enable_notify(&net->dev, vq))) { >> @@...
2017 Nov 30
2
[PATCH net,stable v2] vhost: fix skb leak in handle_rx()
..._consume(&nvq->rxq); >> - /* On overrun, truncate and discard */ >> - if (unlikely(headcount > UIO_MAXIOV)) { >> - iov_iter_init(&msg.msg_iter, READ, vq->iov, 1, 1); >> - err = sock->ops->recvmsg(sock, &msg, >> - 1, MSG_DONTWAIT | MSG_TRUNC); >> - pr_debug("Discarded rx packet: len %zd\n", sock_len); >> - continue; >> - } >> /* OK, now we need to know about added descriptors. */ >> if (!headcount) { >> if (unlikely(vhost_enable_notify(&net->dev, vq))) { >> @@...
2017 Dec 01
1
[PATCH 1/3] vhost: fix skb leak in handle_rx()
...rx_array) - msg.msg_control = vhost_net_buf_consume(&nvq->rxq); - /* On overrun, truncate and discard */ - if (unlikely(headcount > UIO_MAXIOV)) { - iov_iter_init(&msg.msg_iter, READ, vq->iov, 1, 1); - err = sock->ops->recvmsg(sock, &msg, - 1, MSG_DONTWAIT | MSG_TRUNC); - pr_debug("Discarded rx packet: len %zd\n", sock_len); - continue; - } /* OK, now we need to know about added descriptors. */ if (!headcount) { if (unlikely(vhost_enable_notify(&net->dev, vq))) { @@ -800,6 +790,16 @@ static void handle_rx(struct vhost_net *net)...
2009 Nov 02
1
[PATCHv6 1/3] tun: export underlying socket
Tun device looks similar to a packet socket in that both pass complete frames from/to userspace. This patch fills in enough fields in the socket underlying tun driver to support sendmsg/recvmsg operations, and message flags MSG_TRUNC and MSG_DONTWAIT, and exports access to this socket to modules. Regular read/write behaviour is unchanged. This way, code using raw sockets to inject packets into a physical device, can support injecting packets into host network stack almost without modification. First user of this interface wi...
2009 Nov 02
1
[PATCHv6 1/3] tun: export underlying socket
Tun device looks similar to a packet socket in that both pass complete frames from/to userspace. This patch fills in enough fields in the socket underlying tun driver to support sendmsg/recvmsg operations, and message flags MSG_TRUNC and MSG_DONTWAIT, and exports access to this socket to modules. Regular read/write behaviour is unchanged. This way, code using raw sockets to inject packets into a physical device, can support injecting packets into host network stack almost without modification. First user of this interface wi...
2017 Dec 01
0
[PATCH 2/3] tun: free skb in early errors
...> + struct sk_buff *skb = m->msg_control; > int ret; > > - if (!tun) > - return -EBADFD; > + if (!tun) { > + ret = -EBADFD; > + goto out_free_skb; Unfortunately, you can't to there since tun is NULL. > + } > > if (flags & ~(MSG_DONTWAIT|MSG_TRUNC|MSG_ERRQUEUE)) { > ret = -EINVAL; > - goto out; > + goto out_free_skb; > } > if (flags & MSG_ERRQUEUE) { > ret = sock_recv_errqueue(sock->sk, m, total_len, > @@ -2087,6 +2090,11 @@ static int tun_recvmsg(struct socket *sock, struct msghdr *m, size_t total...
2017 Dec 01
0
[PATCH 2/3] tun: free skb in early errors
...n_file, socket); > struct tun_struct *tun = tun_get(tfile); > + struct sk_buff *skb = m->msg_control; > int ret; > > - if (!tun) > - return -EBADFD; > + if (!tun) { > + ret = -EBADFD; > + goto out_free_skb; > + } > > if (flags & ~(MSG_DONTWAIT|MSG_TRUNC|MSG_ERRQUEUE)) { > ret = -EINVAL; > - goto out; > + goto out_put_tun; > } > if (flags & MSG_ERRQUEUE) { > ret = sock_recv_errqueue(sock->sk, m, total_len, > SOL_PACKET, TUN_TX_TIMESTAMP); > goto out; > } > - ret = tun_do_read(tun, tfile,...
2017 Dec 01
0
[PATCH 2/3] tun: free skb in early errors
..., { struct tun_file *tfile = container_of(sock, struct tun_file, socket); struct tun_struct *tun = tun_get(tfile); + struct sk_buff *skb = m->msg_control; int ret; - if (!tun) - return -EBADFD; + if (!tun) { + ret = -EBADFD; + goto out_free_skb; + } if (flags & ~(MSG_DONTWAIT|MSG_TRUNC|MSG_ERRQUEUE)) { ret = -EINVAL; - goto out; + goto out_put_tun; } if (flags & MSG_ERRQUEUE) { ret = sock_recv_errqueue(sock->sk, m, total_len, SOL_PACKET, TUN_TX_TIMESTAMP); goto out; } - ret = tun_do_read(tun, tfile, &m->msg_iter, flags & MSG_DONTWAIT, -...
2017 Dec 01
1
[PATCH 1/3] vhost: fix skb leak in handle_rx()
...ume(&nvq->rxq); > > - /* On overrun, truncate and discard */ > > - if (unlikely(headcount > UIO_MAXIOV)) { > > - iov_iter_init(&msg.msg_iter, READ, vq->iov, 1, 1); > > - err = sock->ops->recvmsg(sock, &msg, > > - 1, MSG_DONTWAIT | MSG_TRUNC); > > - pr_debug("Discarded rx packet: len %zd\n", sock_len); > > - continue; > > - } > > /* OK, now we need to know about added descriptors. */ > > if (!headcount) { > > if (unlikely(vhost_enable_notify(&net->dev, vq))) { >...
2017 Dec 01
1
[PATCH 1/3] vhost: fix skb leak in handle_rx()
...ume(&nvq->rxq); > > - /* On overrun, truncate and discard */ > > - if (unlikely(headcount > UIO_MAXIOV)) { > > - iov_iter_init(&msg.msg_iter, READ, vq->iov, 1, 1); > > - err = sock->ops->recvmsg(sock, &msg, > > - 1, MSG_DONTWAIT | MSG_TRUNC); > > - pr_debug("Discarded rx packet: len %zd\n", sock_len); > > - continue; > > - } > > /* OK, now we need to know about added descriptors. */ > > if (!headcount) { > > if (unlikely(vhost_enable_notify(&net->dev, vq))) { >...
2009 Nov 04
0
[PATCHv8 1/3] tun: export underlying socket
Tun device looks similar to a packet socket in that both pass complete frames from/to userspace. This patch fills in enough fields in the socket underlying tun driver to support sendmsg/recvmsg operations, and message flags MSG_TRUNC and MSG_DONTWAIT, and exports access to this socket to modules. Regular read/write behaviour is unchanged. This way, code using raw sockets to inject packets into a physical device, can support injecting packets into host network stack almost without modification. First user of this interface wi...