From patchwork Thu Aug 20 22:49:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348652 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=tiLXFWLo; 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 4BXfxJ5458z9sPB for ; Fri, 21 Aug 2020 08:50:12 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id E2C4B88527; Thu, 20 Aug 2020 22:50:09 +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 mkdboCpUxmah; Thu, 20 Aug 2020 22:50:08 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id B549C88522; Thu, 20 Aug 2020 22:50:05 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 943A2C089F; Thu, 20 Aug 2020 22:50:05 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id F03E3C0051 for ; Thu, 20 Aug 2020 22:50:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id DB9A3875FE for ; Thu, 20 Aug 2020 22:50:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 53I2Ns3n80iD for ; Thu, 20 Aug 2020 22:50:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by whitealder.osuosl.org (Postfix) with ESMTPS id 5A1B5875DC for ; Thu, 20 Aug 2020 22:50:04 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id o5so67716pgb.2 for ; Thu, 20 Aug 2020 15:50:04 -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=+yaP/fcLQX0vjUMM7xcSw7h9Ktfa5weVQh2OyQJA13Q=; b=tiLXFWLojKdBYP9gCWhtZbZWXvRVI8Sc/Ha/F+uy6koQz8en1XUgkgS6o8+zvUXsAr CtLSu8NGmzFA8XGdInYqxFedc/3Qm34zJBdYuH70Z//rTB3Yysmdn0GGTtF2DpwJu2ln vM3Bt69T3hoXKFbNAVZn//zjdHtOfZbac9X1Hpz28zPaoEvy+uaUOs4h0zC1mj9HsU6U CK6DMgnOD0vtQ6BnsNHE7TUBX9Ifv3wVQY2ks5NukHkxd/gEbmhRTZ61zta1beRTUgor 07lV5Yk1oYjUG2QNpHciqfuT1Edv2FxbjAmMxRPmmKVwst2Hr4dpZNiY9+WVVMzLC/2m DHsw== 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=+yaP/fcLQX0vjUMM7xcSw7h9Ktfa5weVQh2OyQJA13Q=; b=c6yP+ZxEfiahlVphvCU51wXTZ5ZQGJY2ryeSMy3MlEs5dJWtBYyXVls694DkS/u4LO LarpDvc1YIaGq7VHwsSDR2Gc0AZBOjch8m0wHdlb3LaVF8z5lNcd/0gSn4abEOaYf8xE 5A3/F/fa4lVNH3QcEsOarxolKV/lmOBehSLhgsn6ZSI3xsnR1H0Qya+Ozzw5t5tXpfn5 715CTd8WmVHriBVcFZq+11QbjFmykN3+fnqijcGlpfWhB0Mg0l6Nda6jE1IQsbl7qXxS bdNEMoShgM0muiSNier9eNBMaDx3n3MBhQUMDQHSgkY8JobdCyxyU+2NG4cdoFQ/v8QX txYA== X-Gm-Message-State: AOAM531es2RpEXfxdDeSZrAMuJAZgOxafOMDm7xJKLAM9x+v1nRgCQTX P7Prn67ceKzRda6twx9eyPOmodNOzmueYQ== X-Google-Smtp-Source: ABdhPJxCrzW9+cnsq1tdbWql0U3beJpkiX0/WJRvxDeOca5eoZWPJkqnCOaIQUVc19xAGdk6X++Lzw== X-Received: by 2002:a63:33cf:: with SMTP id z198mr246763pgz.348.1597963803643; Thu, 20 Aug 2020 15:50:03 -0700 (PDT) Received: from gizo.domain (97-115-99-106.ptld.qwest.net. [97.115.99.106]) by smtp.gmail.com with ESMTPSA id y6sm116866pfr.61.2020.08.20.15.50.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:02 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:29 -0700 Message-Id: <1597963790-12362-3-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597963790-12362-1-git-send-email-gvrose8192@gmail.com> References: <1597963790-12362-1-git-send-email-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH 02/23] 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 --- datapath/datapath.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 05c1e42..d604bfd 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); }