Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1752060pxj; Wed, 19 May 2021 13:05:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1r9snTQysOOiPQiDhbrWSjDI1KKDfn/E3lTne9tvfzHIJje9rw7ySI/Z0JO7b6CqU2ZAQ X-Received: by 2002:aa7:c70d:: with SMTP id i13mr809691edq.340.1621454740792; Wed, 19 May 2021 13:05:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621454740; cv=none; d=google.com; s=arc-20160816; b=IOpjWAIAYZFpswa4Hs61xxy1bMCMsHqM1Psyw6MkaXMmibfluEOORU07jM26bNKoPW qxAzAlUyI+2KNokYcVF5oLNKv4TgWDGyonxJsQBgDW71zQEnCyEPHhmX+p+nVYeYSfqp ZKfgs++o8gk035DZY3iHgDbRBF5Bl1UsG1kfCIySTpqnAVJbE58NSNFApwM46xSOSqMt guWdL/OiHSemQUFFvxxxsJ+6o4qm4ERJYds5ozdxiHZjE+ezDUD2Ihfw/oR6wNiQ8AW2 TNsVg+8majIPvssYX5N5pLjePsuwd3s4DYouHOrGVD3b+X3Y475YHKTkKXZGz/saiHac gylQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:references:cc:to:subject :from; bh=TojVHOF6vF24zQ5f5P5M1LAZfVvNjHU40pcpZ2PTpmQ=; b=AU7SwWwenQnocBoVb7ua9WIDf1kz9XBGLMzaiJ6mzqmzcewxfFvInAZ8ymQrPkPkS5 amBYZzBw2G4HmYYCETZbIBeHLfYTfPpFDhYIwDDTDJrsUrpXBfIBOPa4jUxYIODqPBmL nL4QCLzVFg0CRMaGtfl3UYhBvEqyS7kMAfX8qYzlkA8hZaTgQywvAGz/EDLDkIdlBe9/ xpVbqvPPYqGSALukLRhgPCTVLS70P8UvStAbVzmDrGdHlJU+nu4Mbvexvx4EfJvg+Cus 4ngH4o8wQ/P3eT7ijSRDQ7Mm/hx5iFcni2Nkykmw6hTLIURMwQn+Z8Lk1puYUqALoW7V 1s0Q== 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 e14si233252edc.52.2021.05.19.13.05.16; Wed, 19 May 2021 13:05:40 -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 S241784AbhESOUM (ORCPT + 99 others); Wed, 19 May 2021 10:20:12 -0400 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]:45947 "EHLO out30-131.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239857AbhESOUJ (ORCPT ); Wed, 19 May 2021 10:20:09 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R211e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=xianting.tian@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0UZPxG0E_1621433926; Received: from B-LB6YLVDL-0141.local(mailfrom:xianting.tian@linux.alibaba.com fp:SMTPD_---0UZPxG0E_1621433926) by smtp.aliyun-inc.com(127.0.0.1); Wed, 19 May 2021 22:18:46 +0800 From: Xianting Tian Subject: Re: [PATCH] virtio_net: Remove BUG() to aviod machine dead To: "Michael S. Tsirkin" Cc: jasowang@redhat.com, davem@davemloft.net, kuba@kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210518055336-mutt-send-email-mst@kernel.org> Message-ID: <4aaf5125-ce75-c72a-4b4a-11c91cb85a72@linux.alibaba.com> Date: Wed, 19 May 2021 22:18:46 +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 In-Reply-To: <20210518055336-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org thanks, I submit the patch as commented by Andrew https://lkml.org/lkml/2021/5/18/256 Actually, if xmit_skb() returns error, below code will give a warning with error code. /* Try to transmit */ err = xmit_skb(sq, skb); /* This should not happen! */ if (unlikely(err)) { dev->stats.tx_fifo_errors++; if (net_ratelimit()) dev_warn(&dev->dev, "Unexpected TXQ (%d) queue failure: %d\n", qnum, err); dev->stats.tx_dropped++; dev_kfree_skb_any(skb); return NETDEV_TX_OK; } ?? 2021/5/18 ????5:54, Michael S. Tsirkin ะด??: > typo in subject > > On Tue, May 18, 2021 at 05:46:56PM +0800, Xianting Tian wrote: >> 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; >> > > why EPROTO? can you add some comments to explain what is going on pls? > > is this related to a malicious hypervisor thing? > > don't we want at least a WARN_ON? Or _ONCE? > >> if (vi->mergeable_rx_bufs) >> hdr->num_buffers = 0; >> -- >> 2.17.1