From patchwork Wed Sep 9 19:19:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1360967 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=VPs6EKGE; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BmsL855RKz9sTN for ; Thu, 10 Sep 2020 05:20:32 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id F07AA87453; Wed, 9 Sep 2020 19:20:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IchuoAnrs3ND; Wed, 9 Sep 2020 19:20:28 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id C6DBD87460; Wed, 9 Sep 2020 19:20:28 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id AE51FC0893; Wed, 9 Sep 2020 19:20:28 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 098DBC0051 for ; Wed, 9 Sep 2020 19:20:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id E95BC87452 for ; Wed, 9 Sep 2020 19:20:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CI9TV9ejIxiK for ; Wed, 9 Sep 2020 19:20:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by hemlock.osuosl.org (Postfix) with ESMTPS id 381C787446 for ; Wed, 9 Sep 2020 19:20:26 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id 34so2760311pgo.13 for ; Wed, 09 Sep 2020 12:20:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Iv3NF2aF38uXjjrJiv94z3e1xZP5ZL18Co5hFGhMkyY=; b=VPs6EKGEWnjUxUc/lQGI/kck/myEJxUddxl7kYHbsaMm917csVhR/QR7FPMo+ogogT PP4ve8InId53AsIJu2nFAa80ZZQKkIyb+gQFe7gyiSii0nr39YTzDxIFGXoNOAQCq28t tv/6xtJ/ZCIzW+8901SNobGc/3NW8VIXufgNMBbNKbndGrmHIeUFqdrUVfPC0OPPQz9D yDwL4Ruz4wn0FH1G/JVeb8FIoheaS7VKfQKD/ar0S+9ZckDCRAfW9av/fsDHZlflMuao NIYZCnHLiobj1pbu4YwoCZ9S3V9LG70UgyFEHiBetXDpdaJfLHFZ+Z6/HHxe2rMCeeOE 3h4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Iv3NF2aF38uXjjrJiv94z3e1xZP5ZL18Co5hFGhMkyY=; b=naD0v9NYm2cqMWNSz/n5fo22GDMkMDmamZmGK4r4iI7DvTxaczuLaIh+SCwdehYfLk kX2aNYSi8eT/57n3xEmncnLfqCy+ikrBmcmuhzo//S8b2v6kSB0tn3vqwh98s6svNqUv cPj+fNeWlun7HpF1GVflx8vPrD6j/7eNQqAYCSZBbP8ndlZRFydVyXk9qT0JyeAmEAPv clJx7bOH3miCfvRYsLRT1vsjrbdciAd4RtZNoBC7tvj3eLcOcaLCEvxZG0mWB940wBE5 Li6NBgpL3wTnyAhZJiZOYW//K1ibhg4IoMOH3kbp3fLwFJxFI5WfQWMr+OkfNW8Bt4MR 4zhA== X-Gm-Message-State: AOAM531qe+06zviAAIeM2TP7bWDx0D1JgrJ6l6cLOlt1jVy8KZMuXrz5 9/oEDfxShKn9p+vqeQbdmwcu5Uh84UqAGg== X-Google-Smtp-Source: ABdhPJxWW0pD21d6AJZsrkG1f3eA4C8AFPn0Y+w9W5PNJtg9jZTW2CXN/zyAY7AIx/RoS68jlX6+1Q== X-Received: by 2002:a63:6782:: with SMTP id b124mr1779105pgc.308.1599679225373; Wed, 09 Sep 2020 12:20:25 -0700 (PDT) Received: from VMware-box.domain ([97.115.183.169]) by smtp.googlemail.com with ESMTPSA id x29sm2866338pga.23.2020.09.09.12.20.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 12:20:24 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Wed, 9 Sep 2020 12:19:58 -0700 Message-Id: <20200909192021.9545-2-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200909192021.9545-1-gvrose8192@gmail.com> References: <20200909192021.9545-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH v2 01/24] datapath: return an error instead of doing BUG_ON() X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Eelco Chaudron Upstream commit: commit a734d1f4c2fc962ef4daa179e216df84a8ec5f84 Author: Eelco Chaudron Date: Thu May 2 16:12:38 2019 -0400 net: openvswitch: return an error instead of doing BUG_ON() For all other error cases in queue_userspace_packet() the error is returned, so it makes sense to do the same for these two error cases. Reported-by: Davide Caratti Signed-off-by: Eelco Chaudron Acked-by: Flavio Leitner Signed-off-by: David S. Miller Cc: Eelco Chaudron Signed-off-by: Greg Rose Acked-by: Eelco Chaudron --- datapath/datapath.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 05c1e4274..d604bfd36 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -469,7 +469,8 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, upcall->dp_ifindex = dp_ifindex; err = ovs_nla_put_key(key, key, OVS_PACKET_ATTR_KEY, false, user_skb); - BUG_ON(err); + if (err) + goto out; if (upcall_info->userdata) __nla_put(user_skb, OVS_PACKET_ATTR_USERDATA, @@ -486,7 +487,9 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, } err = ovs_nla_put_tunnel_info(user_skb, upcall_info->egress_tun_info); - BUG_ON(err); + if (err) + goto out; + nla_nest_end(user_skb, nla); }