Hi,

Herbert Xu wrote:
Oops, this patch had a left-over skb_pull which made it broken.
Here is a fixed version.

tun: Use iovec iterators

This patch removes the use of skb_copy_datagram_const_iovec in
favour of the iovec iterator-based skb_copy_datagram_iter.

Signed-off-by: Herbert Xu <herb...@gondor.apana.org.au>

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 9dd3746..ff955cdb 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
:
@@ -1244,23 +1245,25 @@ static ssize_t tun_put_user(struct tun_struct *tun,
        if (tun->flags & TUN_VNET_HDR)
                vnet_hdr_sz = tun->vnet_hdr_sz;

+       total = skb->len + vlan_hlen + vnet_hdr_sz;
+
        if (!(tun->flags & TUN_NO_PI)) {
-               if ((len -= sizeof(pi)) < 0)
+               if (iov_iter_count(iter) < sizeof(pi))
                        return -EINVAL;

-               if (len < skb->len + vlan_hlen + vnet_hdr_sz) {
+               if (iov_iter_count(iter) < total) {

I guess this should be: sizeof(pi) + total

--
Hideaki Yoshifuji <hideaki.yoshif...@miraclelinux.com>
Technical Division, MIRACLE LINUX CORPORATION
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to