Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1655245pxj; Wed, 19 May 2021 10:44:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEA/1YIZqq3VkErungkJg6+3amcsuXExmc2m1eKavTV6bW10r12wKUsqGIglastYMhIWht X-Received: by 2002:a05:6402:2681:: with SMTP id w1mr203988edd.223.1621446274783; Wed, 19 May 2021 10:44:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621446274; cv=none; d=google.com; s=arc-20160816; b=ZUaeNCtRMn812QITYrQwBcvnH29moJDVa9gCxKxsceEx4/A8D/Z3wjdpXPRe4RY4P4 fhefuguJr0z/Zf/BxuOHqamrW9fISZz9K447ZfaVbQA5zpvzvEGfviPGbx5STTv4vS/N iO4tRCUtRMrzUlHloNOnZk0WOxuy/V1m/IJ7aOYSfccAR8ZoAWWc4qEb5VGKn6upzYvQ ImtZUOAQPNhJ892nY4hr2rQT5PkyHdBG8lgJa69mMBuy97f10N5buN/U2sr8zwvo9hMq pTpgN3vM1fSHP6BrgcJtxtN5GRr2aQgBCXwRpDgGEWwqlFsMCAfUOV2M4jinrWmMvmQe ll6A== 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=+VCDqtzyoP1/MzTBF9IVeYAYQ0ccxPfD6Ur9tV2oQ+o=; b=X0FNX0N5PuVCJS6bWC9Ib2/rYR2CBexTW4th9yhsmZTxZEaVlVXD1BN/MDwo8Hi4QM w0v0BKvz4zO7kAtuOUtZDDZx5u9/sGqWldaZ2yG9oUkG3BTeyr9eh0KNYpsgSIl1hm/A oBE7EM09F/r0hIp+inYNsdtP309l081U9V0wgRpz1Nr3uCaJiplZw5M2IwTp4mKsOF/X yRAnOx7yEyRWMzoSn9qtWQoIMr4/aXjAnmNeTrOnXmurPTRc1MCc77gRWhrpMFRZRC99 cOaxLEimkyrAUYFtT0kPlJkAg8iYD3S4/4CTq6vLaPxQH0HaS0+jhWjfOun7G3/0wDb0 XpZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QxslfdtD; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m1si22704765edb.244.2021.05.19.10.44.11; Wed, 19 May 2021 10:44:34 -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=@redhat.com header.s=mimecast20190719 header.b=QxslfdtD; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348065AbhERJ4T (ORCPT + 99 others); Tue, 18 May 2021 05:56:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:48231 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241006AbhERJ4S (ORCPT ); Tue, 18 May 2021 05:56:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621331700; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+VCDqtzyoP1/MzTBF9IVeYAYQ0ccxPfD6Ur9tV2oQ+o=; b=QxslfdtDobxarcH53NHc1d5Yvhmg2VC8nDhk3/a3yfeAJ6Yy1BRYx2S3ylP5cgriCo741d IE5LpTQobzL57pZfBfuJEeJhkqis5vvd9Qa22d5ux1eyTSC6KMKyukgKff7k8/jXV7F83g pkTgw6sRJZ6KC/iPjhZu6yC8c4DNJkw= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-34-aLXZg9jzNeuW7yahtncapQ-1; Tue, 18 May 2021 05:54:58 -0400 X-MC-Unique: aLXZg9jzNeuW7yahtncapQ-1 Received: by mail-wr1-f69.google.com with SMTP id x10-20020adfc18a0000b029010d83c83f2aso5334100wre.8 for ; Tue, 18 May 2021 02:54:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=+VCDqtzyoP1/MzTBF9IVeYAYQ0ccxPfD6Ur9tV2oQ+o=; b=sMN/U2lYdMUGC4UgfHmy5VGs9Pe4syAOd+EcFsAMcEjzzxtIASpHKPgBEk9U6kKURL rILNdxG/4sTFpTya/K5WGVFroc7w73dFhO4P+qVhirYM/I8sf2kNCv5ciqgFnTNXDl8W lHC92LYOfZfGg8vE8Sm+mhd4krUsMZPz1U+dnKt1WDjtNKGsjeM3RY71cosK3HrtcaVs dMinO4MIrZ5H8H14Vphpr+E0D+bkx3P9+hWMXcD3drJP+aSS+vb0Xx3nilFGdX9CTQEH 9NXnsTrjQ08uq9Ar7SeOqxPGrokuFVHaT+/8T02sXwNByjMYRn5aG71+6FQc+3BVaCLH /2gQ== X-Gm-Message-State: AOAM530DRZjjO6Agas/85rOKq6f6p04u0rXnMegPkYlBdtWcVUsfsaek qa6KZ9/8k355XgA2orReq+Z7dZAYzm0mDTpj1P0F8/erzdwEmvUuCJEqRrgNZdSsOCNU9MyeG2/ kOgohN2Z9kGSj7h7WBuyo0zTv X-Received: by 2002:a1c:ed0a:: with SMTP id l10mr4484502wmh.151.1621331697559; Tue, 18 May 2021 02:54:57 -0700 (PDT) X-Received: by 2002:a1c:ed0a:: with SMTP id l10mr4484493wmh.151.1621331697424; Tue, 18 May 2021 02:54:57 -0700 (PDT) Received: from redhat.com ([2a10:800c:1fa6:0:3809:fe0c:bb87:250e]) by smtp.gmail.com with ESMTPSA id f6sm24076804wru.72.2021.05.18.02.54.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 02:54:56 -0700 (PDT) Date: Tue, 18 May 2021 05:54:54 -0400 From: "Michael S. Tsirkin" To: Xianting Tian Cc: jasowang@redhat.com, davem@davemloft.net, kuba@kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] virtio_net: Remove BUG() to aviod machine dead Message-ID: <20210518055336-mutt-send-email-mst@kernel.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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