From patchwork Wed Sep 16 17:32:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1365660 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=fq8VLrgz; 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 4BsJ7S3GjGzB40r for ; Thu, 17 Sep 2020 10:41:40 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id AC5FB87417; Wed, 16 Sep 2020 17:33:19 +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 ML+IWoqqt-wa; Wed, 16 Sep 2020 17:33:18 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 80D0F8734C; Wed, 16 Sep 2020 17:33:18 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 66E26C0864; Wed, 16 Sep 2020 17:33:18 +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 0C231C0051 for ; Wed, 16 Sep 2020 17:33:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id EC7C187371 for ; Wed, 16 Sep 2020 17:33:16 +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 0f3qB9+vqqYn for ; Wed, 16 Sep 2020 17:33:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by hemlock.osuosl.org (Postfix) with ESMTPS id 386088734C for ; Wed, 16 Sep 2020 17:33:16 +0000 (UTC) Received: by mail-pj1-f67.google.com with SMTP id jw11so1892284pjb.0 for ; Wed, 16 Sep 2020 10:33:16 -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=yhwd80OrJSBMb6pSIY7Z4LcluF0kS5sHd2hZMWa8e4c=; b=fq8VLrgzlBiWGua62cPUYaGwwXnaOYi0dA6fLF1Dxu/vIubekPzGpAUbLkWDn60OG2 /yeRgVDeIXQhROGT5HY8Skqtea9B9InKwEjH5+q92MYwmSvG7m5LfgzxyDZpc9kWxgwc uIUwClSdM66W2aR9I+RS9gZYIMzoDJp0gFdLZjwZ/L1LVVU8QILtcxhuILW+hMJF7Yeg fbz10aWALA9BRxj5Gir4zfsAPaZxbgygGQNUcuFzDOGq8bkRq1MPZU4D+mwsQUSyMJ6v cgxHo+/tatvrfabXm/c4N0fOrSvRN/RTenb350t5IOERiq98iD4GLzz3iOBISzWvFMJ1 20MQ== 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=yhwd80OrJSBMb6pSIY7Z4LcluF0kS5sHd2hZMWa8e4c=; b=TvmGwL/z2qzFRRqNazPJCGpsMfvt9arvDFCGKNzoYLD/mJsvk+cG4fDb6zNcakFseb qD2cRgH6uFBl837nJYT2QKSRdinpUPatk0hzKM+zgBJDWQVVNKLsSMzLggDX+HEv1peH X1pjiKkbZI0xIfZYMaxZ56dNK+kxI/om5fIi3HXSME4RnQejcfn3plCm/zily7lO9gKD UugJqfOpz1ijU5RsPq+Xk+SbuWMu4t2ihyDpZV4mWNzs0v7hgTXo0To+AwcKvzlBwOKF WaTNrJeKDD2hvpgg+QWLNME/ZDZsS3t6OoAuD20cTwAARyYSH9BZnIs8tqfyPsDIntuK y12g== X-Gm-Message-State: AOAM530rc/lgSsUxOdm01HwcFx+WfLLiPtqKiJkZtk5wpbA4sqX3jrfE 95yop88A+Te00V25M59mO7NZ4+je0z465g== X-Google-Smtp-Source: ABdhPJy3nc3wtZDV3bUhrEJPfJh+SQofpKNzPMAHqrwmUq+G7IUO+u7c+Gq9EBfTChd6Jk7273a5BA== X-Received: by 2002:a17:90a:f686:: with SMTP id cl6mr4774119pjb.43.1600277595444; Wed, 16 Sep 2020 10:33:15 -0700 (PDT) Received: from VMware-box.domain ([97.115.183.169]) by smtp.googlemail.com with ESMTPSA id o20sm16248519pgh.63.2020.09.16.10.33.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 10:33:14 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Wed, 16 Sep 2020 10:32:48 -0700 Message-Id: <20200916173311.30956-2-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200916173311.30956-1-gvrose8192@gmail.com> References: <20200916173311.30956-1-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V3 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 Acked-by: Eelco Chaudron Signed-off-by: Greg Rose Acked-by: Yi-Hung Wei --- 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); }