From patchwork Wed Sep 9 19:20:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1360973 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=FrGFFITg; 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 4BmsLy1tXhz9sTN for ; Thu, 10 Sep 2020 05:21:14 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id BDBDD870F7; Wed, 9 Sep 2020 19:21:12 +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 mTogHNh9HxmI; Wed, 9 Sep 2020 19:21:08 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 07F0186F16; Wed, 9 Sep 2020 19:20:56 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B9B82C08A9; Wed, 9 Sep 2020 19:20:55 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id DB011C0893 for ; Wed, 9 Sep 2020 19:20:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C45F086D19 for ; Wed, 9 Sep 2020 19:20:52 +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 LHJg_KW4iPWi for ; Wed, 9 Sep 2020 19:20:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 8E8A886D56 for ; Wed, 9 Sep 2020 19:20:47 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id o20so3007123pfp.11 for ; Wed, 09 Sep 2020 12:20:47 -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=i6XDYr7DanxYgk7SCB6twupNxxzBfHNbfniZ73SOFJM=; b=FrGFFITgQEWzd3aW5FZh3o1v44LX4jspwOkV89smKVerjp3Lf4zBVQ+ZAu9L5Xefrd o/CPbX2Qo8BwlwAXphUf+AeQv8P9D7QOGfkg70ihzKzEtTF3EwvGsh37/FFv7h6DVrDJ pKCgz0rXdZuhHgEojqfXkrGOyOIp0dDFKfxIy+sJhcD/QOddBCoyu12j0IpIjnrwTfql kgblBiXPwk1nJ5h+dh/UGDz0YtICIA3QRWGEU7BfgYpkHVCYw1lPnNiN/MaN4JUjMlYi u6uDCPupbzAgGr+2jwLxpuaTGVVY42wfRQwClhQ3QKHnoz6wwxj5UQs9zrkGkO9Gl/v4 Rh/A== 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=i6XDYr7DanxYgk7SCB6twupNxxzBfHNbfniZ73SOFJM=; b=AOaOjFAJjuVgmv08paFYWcBokZrI7Xc6/dCN6vSUh4PpBCEmNIe+znT8GsaEh9bDdy 8XDxyIGu8xK0Y4vDm52iQSgZzneWU/rJjdqrvLCky67SEvu55JSsev9Zi5iUMMftikkN o/E+3Q7XjOflH2oNC0/21DBXkYy2cIwFP8ae1L7WF9fezy2o+enQw1WbIBrkP5C5kkD1 x+u7cmUFTWuIzUIZGZLTzwP4SwE/3TOccfELDexGcC+Q39YNVQRrlPcewKdkLgooNTxd CvxBSFFvXwrN7Voo0MrNS0jD89LnXvRO1LbBkK7TRrL+zw3TbZ+wuiWNAzVsaLPE7jYU VejQ== X-Gm-Message-State: AOAM532tzeXHp1KIi25TrcqOycwG1N2VoNlviW/XiA3kf2P4HeN1nHiZ 0PZ9uiIZspJxJ8kip3wChOg1BzqfccDvPg== X-Google-Smtp-Source: ABdhPJx2DNjZH545BG0xBu9VUDMweCNGf5S6O72jZzL41iM73yccRLu1SCt8IumkBa9xD0nBzsMaVA== X-Received: by 2002:a17:902:a40e:: with SMTP id p14mr2171066plq.4.1599679246801; Wed, 09 Sep 2020 12:20:46 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 12:20:46 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Wed, 9 Sep 2020 12:20:14 -0700 Message-Id: <20200909192021.9545-18-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> Cc: Paolo Abeni Subject: [ovs-dev] [PATCH v2 17/24] datapath: remove another 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: Paolo Abeni Upstream commit: commit 8a574f86652a4540a2433946ba826ccb87f398cc Author: Paolo Abeni Date: Sun Dec 1 18:41:25 2019 +0100 openvswitch: remove another BUG_ON() If we can't build the flow del notification, we can simply delete the flow, no need to crash the kernel. Still keep a WARN_ON to preserve debuggability. Note: the BUG_ON() predates the Fixes tag, but this change can be applied only after the mentioned commit. v1 -> v2: - do not leak an skb on error Fixes: aed067783e50 ("openvswitch: Minimize ovs_flow_cmd_del critical section.") Signed-off-by: Paolo Abeni Signed-off-by: David S. Miller Cc: Paolo Abeni Signed-off-by: Greg Rose --- datapath/datapath.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 877c8bdba..deffb3a60 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1414,7 +1414,10 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info) OVS_FLOW_CMD_DEL, ufid_flags); rcu_read_unlock(); - BUG_ON(err < 0); + if (WARN_ON_ONCE(err < 0)) { + kfree_skb(reply); + goto out_free; + } ovs_notify(&dp_flow_genl_family, &ovs_dp_flow_multicast_group, reply, info); } else { genl_set_err(&dp_flow_genl_family, sock_net(skb->sk), 0, @@ -1423,6 +1426,7 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info) } } +out_free: ovs_flow_free(flow, true); return 0; unlock: