Skip to content

Commit ef3db4a

Browse files
mstsirkindavem330
authored andcommitted
tun: avoid BUG, dump packet on GSO errors
There are still some LRO cards that cause GSO errors in tun, and BUG on this is an unfriendly way to tell the admin to disable LRO. Further, experience shows we might have more GSO bugs lurking. See https://bugzilla.kernel.org/show_bug.cgi?id=16413 as a recent example. dumping a packet will make it easier to figure it out. Replace BUG with warning+dump+drop the packet to make GSO errors in tun less critical and easier to debug. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Alex Unigovsky <unik@compot.ru> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d8190df commit ef3db4a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

drivers/net/tun.c

+12-2
Original file line numberDiff line numberDiff line change
@@ -736,8 +736,18 @@ static __inline__ ssize_t tun_put_user(struct tun_struct *tun,
736736
gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
737737
else if (sinfo->gso_type & SKB_GSO_UDP)
738738
gso.gso_type = VIRTIO_NET_HDR_GSO_UDP;
739-
else
740-
BUG();
739+
else {
740+
printk(KERN_ERR "tun: unexpected GSO type: "
741+
"0x%x, gso_size %d, hdr_len %d\n",
742+
sinfo->gso_type, gso.gso_size,
743+
gso.hdr_len);
744+
print_hex_dump(KERN_ERR, "tun: ",
745+
DUMP_PREFIX_NONE,
746+
16, 1, skb->head,
747+
min((int)gso.hdr_len, 64), true);
748+
WARN_ON_ONCE(1);
749+
return -EINVAL;
750+
}
741751
if (sinfo->gso_type & SKB_GSO_TCP_ECN)
742752
gso.gso_type |= VIRTIO_NET_HDR_GSO_ECN;
743753
} else

0 commit comments

Comments
 (0)