Skip to content

Commit

Permalink
tun: Fix GSO meta-data handling in tun_get_user
Browse files Browse the repository at this point in the history
When we write the GSO meta-data in tun_get_user we end up advancing
the IO vector twice, thus exhausting the user buffer before we can
finish writing the packet.

Fixes: f5ff53b ("{macvtap,tun}_get_user(): switch to iov_iter")
Reported-by: Marcelo Ricardo Leitner <mleitner@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Herbert Xu authored and David S. Miller committed Dec 3, 2014
1 parent cbc2465 commit d8febb7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,

if (gso.hdr_len > len)
return -EINVAL;
iov_iter_advance(from, tun->vnet_hdr_sz);
iov_iter_advance(from, tun->vnet_hdr_sz - sizeof(gso));
}

if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) {
Expand Down

0 comments on commit d8febb7

Please sign in to comment.