Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2324553pxj; Sat, 5 Jun 2021 21:53:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyR7xzEBJXmsuumm+yk1xSvM+bGjVhitSqBojVsQbwWl+zDAHq3qc1rlCANU6hR3a3+dWG4 X-Received: by 2002:a17:907:1c1c:: with SMTP id nc28mr11899880ejc.519.1622955211391; Sat, 05 Jun 2021 21:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622955211; cv=none; d=google.com; s=arc-20160816; b=EBvvdFbwbXz1oPzxgP9THJ206VfDpEHjattvPlyTEfQLqEMU3IQuyQQXmvjHlTq8XA YoAk5dbDnwDZrEYTY01X1chickgyfx+QW/ZziJMrRlm8hqeQN3KY036at6KwXj1Fq7hJ 0r16EUkv9/Wm0QnJFFat9LK1qAgXOXnYGNfu0SAGVjELi3AgqzCbYX+WdDjk+uyVwUrD 96u0gevaEl08/34qsdPGV+2U13yIVak0zMpwY2AHhMqQ95+Nc9K8/mHp2nAmPdvZLEPt ZwgPVLYbfsidSRIvPHX0Ghm6QonJdkjOKsOksB0avMynmodvCtC9ZGLaGsK3KFJIVC9a NO1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=sDgOpmgHDXUxgcjmBik0b3krs+7daF6q8vGNZAEN7lQ=; b=YVcSH/1//6tBrCymzbh8bk5VcPc9KIChI/2sbbT4ZhdPBRmMPFygb2kJCf0DXl5i2D PYgTpw2WuifbFVx8tbE8y47+FgTcylGvQRJQzw5u4U0/c3JTa4OFFWSF1U3Tm2WFqnOo Uh6DPokUWYVKcwhRg/SHwoDr0oVryBx5Bz4oJluSr6EpBZ6QVOEj1GsRQ+uzfgf31HrH rrjLCrhZTKEqJWVh+ZDE6oRLBtxfK+v1SuFvtixmLDbOUl+YZ1tvEs7Gin1bqRAvIzK2 Jof3pvRHdFnBN7plrzDQa9dK/Lk00L0wlotyDucdw+7Sxfhj86CfLe+eabjGJm/0DHBs Nqag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WrpMwiDM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s13si4862450edr.184.2021.06.05.21.53.08; Sat, 05 Jun 2021 21:53:31 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WrpMwiDM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229464AbhFFEuK (ORCPT + 99 others); Sun, 6 Jun 2021 00:50:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:46058 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229630AbhFFEuK (ORCPT ); Sun, 6 Jun 2021 00:50:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8BBA66136D; Sun, 6 Jun 2021 04:48:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622954901; bh=xaAcrglNijmjCFRiE7xF8pepjMBrLn/aQY5rCt+Ggk4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WrpMwiDMuvUaTuOHiy5T1Dr5GHq+5lJmfe5CN0f5E+Rqn3yieIB4CQjUopy6FhUfd B3i9xpfbkVXtEX6Fhpr7G/wtQlTQGTnUxhCootQP3vzTyce6cFtwhTdpSGkV66KesB oZ7ON8SdBgHhaC6mS4jrXZKfPQM7bo/rkK5OLDtpL4b16t1ZYrnezkgt7lo9g4EgfK BXiFgQ/0ep4eoYeSkCikWa61Z163AuRBH7P3oZWezN1QB+PEejE1a2Dm738QBDUzuS OonzJrQo2e5xR1GMbLT0Ctev/hmxAAIfAhDNYPF0RSU9Dg9AwfyKMBgcatV+11SqrC MDpcM2J405MXA== Date: Sun, 6 Jun 2021 07:48:17 +0300 From: Leon Romanovsky To: Xianting Tian Cc: mst@redhat.com, jasowang@redhat.com, davem@davemloft.net, kuba@kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, Xianting Tian Subject: Re: [PATCH] [v2] virtio_net: Remove BUG() to avoid machine dead Message-ID: References: <1622907060-8417-1-git-send-email-xianting_tian@126.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1622907060-8417-1-git-send-email-xianting_tian@126.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 05, 2021 at 11:31:00AM -0400, Xianting Tian wrote: > From: Xianting Tian > > 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 > --- > drivers/net/virtio_net.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index 9b6a4a8..7f11ea4 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -1623,7 +1623,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; Yeah, as we discussed, BUG*() macros in non-core code that checks in-kernel API better to be deleted. Thanks, Reviewed-by: Leon Romanovsky