virtio_net: Remove BUG() to avoid machine dead
authorXianting Tian <xianting.tian@linux.alibaba.com>
Sat, 5 Jun 2021 15:31:00 +0000 (11:31 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Jun 2021 20:06:46 +0000 (13:06 -0700)
We should not directly BUG() when there is hdr error, it is
better to output a print when such error happens. Currently,
the caller of xmit_skb() already did it.

Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/virtio_net.c

index f8f5b8646a4312a62646d7c0a0e841fec0408d8c..0416a7e00914f22e2c38b0e26f46f11c122d020c 100644 (file)
@@ -1636,7 +1636,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
        if (virtio_net_hdr_from_skb(skb, &hdr->hdr,
                                    virtio_is_little_endian(vi->vdev), false,
                                    0))
-               BUG();
+               return -EPROTO;
 
        if (vi->mergeable_rx_bufs)
                hdr->num_buffers = 0;