From patchwork Wed Sep 16 17:33:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1365684 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.138; helo=whitealder.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=ijQh9C2U; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BsJ9N3xQnzB41s for ; Thu, 17 Sep 2020 10:43:20 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id CBC398746A; Wed, 16 Sep 2020 17:34:16 +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 I8XZ1a2Uc1+G; Wed, 16 Sep 2020 17:34:12 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 00F568743F; Wed, 16 Sep 2020 17:33:47 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E0AF7C0895; Wed, 16 Sep 2020 17:33:46 +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 D6474C1AE2 for ; Wed, 16 Sep 2020 17:33:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id BEC818741B for ; Wed, 16 Sep 2020 17:33:43 +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 CHnelOPYXjor for ; Wed, 16 Sep 2020 17:33:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by whitealder.osuosl.org (Postfix) with ESMTPS id 88D458745C for ; Wed, 16 Sep 2020 17:33:35 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id k13so3567279plk.3 for ; Wed, 16 Sep 2020 10:33:35 -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=ijQh9C2UGgx8UwRteKMMte+D76I5DAq3pc+PkVzfgx6Czq2vnbbPYTGU1ODiSRnwco eBxl5Pbs3k9q9u8LvMPolUADfWjL6ciynmx7HQ7GUMEXVnpYELUdhNdmlN5Y3PZ16skP D4pOwaJnNxiC9PbpGjD9Y5wh+6wCnDL/kju21mGGD4vdfOTvokZS0LpePWqpYX8RiiiH QJR4rD2YByT5FD17yTT2zL8kYuT0efpCr6nDIj6RUfamRtLZE7Qu/GvHB3ipjDAzJNCQ 0YeA81GsizVwrgqiaoVvGh24PMbyWh/80rhiG02p3vboaEUrrH2ql4xVyjsWg2VCjYIi lWBw== 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=rwLK3hffZSMRAg5GGYOKq/PSsrx6e4nEQmcsjJo7DxpM7nSAlnFMf/GW/LPkx+7YJ1 M52bHM4mcCxFHYPm/YxbqnNUKEdTTrf5Um3O1DVyhyKbHdb+nFrDgzLry3ExZXDQhyTK 6L4t/0GcDjH6o14IAoIp4aqAWYcGuMGEg/A4hNk1CWJxQTTVpIXjfERfDZYiOK0h6uHB M2b4iyQQyKR2tkI5Bw+HbrIe/sMiPyfFJ4V/lfL1kNktjgPq2YNlE6A3tg47ed1vMa4Y qVbd98Olc6O5auKvNqWjIsBOBtU0k7PlQDdrnVZIzDJyeeEqNwRik5qOKY4HjrZ36o5s zt3Q== X-Gm-Message-State: AOAM532THU6BL1Pk4PQcoeJNa66SoFX/9wxutGT4jHNkq6eyC75HIXAj 18JjzHhVnusLjLj84eQXmXChOFOEYKRI1g== X-Google-Smtp-Source: ABdhPJzoXqpd+HD+teEVgkT/FKZOqpEV7kWI2c9QkK7uDVKrXwNvQ69Fu361d5SQJQgkA9H3ts6gsg== X-Received: by 2002:a17:902:9301:b029:d1:cc21:99d0 with SMTP id bc1-20020a1709029301b02900d1cc2199d0mr13498905plb.25.1600277614783; Wed, 16 Sep 2020 10:33:34 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 10:33:34 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Wed, 16 Sep 2020 10:33:04 -0700 Message-Id: <20200916173311.30956-18-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> Cc: Paolo Abeni Subject: [ovs-dev] [PATCH V3 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 Acked-by: Yi-Hung Wei --- 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: