From: Herbert Xu Date: Sun, 30 Nov 2014 10:03:31 +0000 (+0800) Subject: tun: Fix GSO meta-data handling in tun_get_user X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d8febb77b52ebddb9bd03ccaa5b61005e3a45a85;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git tun: Fix GSO meta-data handling in tun_get_user 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: f5ff53b4d97c ("{macvtap,tun}_get_user(): switch to iov_iter") Reported-by: Marcelo Ricardo Leitner Signed-off-by: Herbert Xu Acked-by: Jason Wang Signed-off-by: David S. Miller --- diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 4b743c612624..6d44da184594 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -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) {