Skip to content

Commit d8febb7

Browse files
herbertxdavem330
authored andcommitted
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: f5ff53b ("{macvtap,tun}_get_user(): switch to iov_iter") Reported-by: Marcelo Ricardo Leitner <[email protected]> Signed-off-by: Herbert Xu <[email protected]> Acked-by: Jason Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent cbc2465 commit d8febb7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/tun.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
10521052

10531053
if (gso.hdr_len > len)
10541054
return -EINVAL;
1055-
iov_iter_advance(from, tun->vnet_hdr_sz);
1055+
iov_iter_advance(from, tun->vnet_hdr_sz - sizeof(gso));
10561056
}
10571057

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

0 commit comments

Comments
 (0)