Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1653278pxj; Wed, 19 May 2021 10:41:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwi/VbXudOjoeI3GnvbjNIHV/YcNgkmKEsN7sA3bS2R6fsFV/Q0pZxLJafQ4B3X6b9v0XDT X-Received: by 2002:a5d:9842:: with SMTP id p2mr649494ios.132.1621446106211; Wed, 19 May 2021 10:41:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621446106; cv=none; d=google.com; s=arc-20160816; b=OGwLuiTefx/6rvJCJOvwKL1sqcgNHtCO+JIhJN3X/rHXpXUhWMQP8muHN2xLMe4nT4 dwa448ZyjCFdkudkJW58ngameEaSfvvIyfxRSBhaNf3YH0Djn0YP9F2kBpo101LdqEgD 7THqKzXUy6p0HDssiaByFbwShg+xwkWRZHwW7plN+QWzmApd+5Vi6XUGAA+DxhQCAHPe NVoxvbPIRj8V1cquI1o/s3LV6tgve3HprSiFajagxf4ZTuQ2HzjSDR8nbZO09G6witjS 9YAcbzEkqdkJKE6jFvpFUYcNprJLWnf49o04c4Oe8OaJ0uzye/cZ1FNdqXRkbfBQAoMR 54Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:date:message-id:cc:to:subject:from; bh=C1tm9DW/sSxwUigswQASx/DPGUT4KKzvCkvtK/UYC6o=; b=MhHtML+oUZV7iFgBSY2UcUH7jWOrIKS4niwrrj9LssggVTaSXqPV10IJUd8RNg2dEr qEIj+uKP872efVLbDbeXJVJPF6xkFyWT2g53aZeHdbjv/0wNsoGIO1jq9ZHsra5r1fuH rTfNthiS1TkWPfswtlMSEfJyzhuiZbLe4qoHzUZSM6vTVO/mfwHJwMgR4dEkeGsYtYlU eLyTyRMIE0VI9Wu6+dmodq8cqRoyG3QihGO51cDLC4fgdxgncVvcu4GTU+NcY+v0/dxq mTvtJf1g0WkPFAWROBhnSa6cnlplmW1YJ891GACZZf7+Ym+V+6giBuqpyrmtL+8/v3Vt guTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c15si26533453jag.124.2021.05.19.10.41.33; Wed, 19 May 2021 10:41:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347534AbhERJsR (ORCPT + 99 others); Tue, 18 May 2021 05:48:17 -0400 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]:41761 "EHLO out30-56.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241211AbhERJsQ (ORCPT ); Tue, 18 May 2021 05:48:16 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=alimailimapcm10staff010182156082;MF=xianting.tian@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0UZIo.Ua_1621331216; Received: from B-LB6YLVDL-0141.local(mailfrom:xianting.tian@linux.alibaba.com fp:SMTPD_---0UZIo.Ua_1621331216) by smtp.aliyun-inc.com(127.0.0.1); Tue, 18 May 2021 17:46:57 +0800 From: Xianting Tian Subject: [PATCH] virtio_net: Remove BUG() to aviod machine dead To: mst@redhat.com, jasowang@redhat.com, davem@davemloft.net, kuba@kernel.org Cc: virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: Date: Tue, 18 May 2021 17:46:56 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When met error, we output a print to avoid a BUG(). Signed-off-by: Xianting Tian --- drivers/net/virtio_net.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index c921ebf3ae82..a66174d13e81 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -1647,9 +1647,8 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) hdr = skb_vnet_hdr(skb); if (virtio_net_hdr_from_skb(skb, &hdr->hdr, - virtio_is_little_endian(vi->vdev), false, - 0)) - BUG(); + virtio_is_little_endian(vi->vdev), false, 0)) + return -EPROTO; if (vi->mergeable_rx_bufs) hdr->num_buffers = 0; -- 2.17.1