From patchwork Thu Aug 20 22:49:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348671 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.137; helo=fraxinus.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=R0bNfXEJ; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BXfzX5jZQz9sPB for ; Fri, 21 Aug 2020 08:52:08 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5925686BEC; Thu, 20 Aug 2020 22:52:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ISEenWnqysKK; Thu, 20 Aug 2020 22:52:04 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id D3EB286C78; Thu, 20 Aug 2020 22:52:04 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id BB525C0889; Thu, 20 Aug 2020 22:52:04 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id C6B74C0051 for ; Thu, 20 Aug 2020 22:52:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id B44CD25351 for ; Thu, 20 Aug 2020 22:52:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ulpTjvT1odig for ; Thu, 20 Aug 2020 22:51:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by silver.osuosl.org (Postfix) with ESMTPS id 9927C232BD for ; Thu, 20 Aug 2020 22:50:31 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id 17so87587pfw.9 for ; Thu, 20 Aug 2020 15:50:31 -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=9etBSQ7JIQ6y9CxL1NFQnmHQir8YITBb9xr/yGYQXCo=; b=R0bNfXEJPsleKBtKLMPxPXoq710DVlbD/vtQXGPSGwXuGsqTtJre1VV+/rd91fIA+g cFUHDHWha7kHmUKf2JXVX93zpSrGWKgBSXDwY7l+070u6ye3Z7ymMypHzH+NcR7mYY0H LrjpEwlW0T7lN8ZOUSOeMejQLtM/RJfifGjpUGTWLe45Oja0EpIFfRMIxv29dnI+pq3i sb0FVSAUfAtVPAmoXwyIdT5/sXOhDJ6fBrmixFVn2bswP0/7ExErWY9/iKLnIOiWhtVT 6+/RVp6KqZbbjD8Z4UcihWmAtbKu9M6OaBUrLnOvoYswL4r/1gGrzVV+9xGr7XRBeLWI EYzQ== 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=9etBSQ7JIQ6y9CxL1NFQnmHQir8YITBb9xr/yGYQXCo=; b=Cu00zovWoi2XyOwUavc6b9mRS9VpZc7UydAE4tdPXzPt8J7eTZYUvBzrzwZchg45JB 3rXp5ngt4125bYR4CAP8gCg08dpcChGzwglfg5uxCkzamE3H6/Y861+AeIOHzg6tQDvs o8LNcL3Ai4LcRWTTZP+Hjtf4yoOm0dbv1B29xMmXY+BId3kwMoXw4l1Q+1Za4s2XYhjX 2Bz5ewhywgSx6REr28Ynsjg83yS1hnK3RJoSZMs9esy6qjuKcKyo6EK5bZOD1wl6UZr7 k5oaEyiwk/XH0yevgluOFN1Gl84oixdoIYuicb4qTUX+XavWho8dAH2UAlpW0GtwqCXU y1dA== X-Gm-Message-State: AOAM533n3ZflCOrf2L06ehT4dNz1vGmXMrTW8kiYQ4CVByvC125zh9lN b9ztx+L8cccrFpqLBhiifktBuxVnMblQ4A== X-Google-Smtp-Source: ABdhPJziaW0L3ho1jfAifiC5+lJsrdrRtQsVWYfSbxl8FHTUhyvGBAJ0FbrAKoWYix2rCapJWia/rg== X-Received: by 2002:aa7:984e:: with SMTP id n14mr65309pfq.272.1597963830137; Thu, 20 Aug 2020 15:50:30 -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.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:29 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:44 -0700 Message-Id: <1597963790-12362-18-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> Cc: Paolo Abeni Subject: [ovs-dev] [PATCH 17/23] datapath: drop unneeded BUG_ON() in ovs_flow_cmd_build_info() 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: Paolo Abeni Upstream commit: commit 8ffeb03fbba3b599690b361467bfd2373e8c450f Author: Paolo Abeni Date: Sun Dec 1 18:41:24 2019 +0100 openvswitch: drop unneeded BUG_ON() in ovs_flow_cmd_build_info() All the callers of ovs_flow_cmd_build_info() already deal with error return code correctly, so we can handle the error condition in a more gracefull way. Still dump a warning to preserve debuggability. v1 -> v2: - clarify the commit message - clean the skb and report the error (DaveM) Fixes: ccb1352e76cf ("net: Add Open vSwitch kernel components.") Signed-off-by: Paolo Abeni Signed-off-by: David S. Miller Cc: Paolo Abeni Signed-off-by: Greg Rose --- datapath/datapath.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 047b331..877c8bd 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -946,7 +946,10 @@ static struct sk_buff *ovs_flow_cmd_build_info(const struct sw_flow *flow, retval = ovs_flow_cmd_fill_info(flow, dp_ifindex, skb, info->snd_portid, info->snd_seq, 0, cmd, ufid_flags); - BUG_ON(retval < 0); + if (WARN_ON_ONCE(retval < 0)) { + kfree_skb(skb); + skb = ERR_PTR(retval); + } return skb; }