From patchwork Thu Aug 20 22:49:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348669 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=QLPSZCB4; 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 4BXfz04vVhz9sPB for ; Fri, 21 Aug 2020 08:51:40 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5849C8854C; Thu, 20 Aug 2020 22:51:38 +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 5ydOCx8Yizav; Thu, 20 Aug 2020 22:51:35 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 9C52288612; Thu, 20 Aug 2020 22:51:17 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 788CDC0894; Thu, 20 Aug 2020 22:51:17 +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 0EA43C0889 for ; Thu, 20 Aug 2020 22:51:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E3D288865D for ; Thu, 20 Aug 2020 22:51: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 d3pRO6uruc0a for ; Thu, 20 Aug 2020 22:51:13 +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 EBDC388557 for ; Thu, 20 Aug 2020 22:50:33 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id 189so45886pgg.13 for ; Thu, 20 Aug 2020 15:50:33 -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=hmZXcG40f0yJJFflewfqCQj9P+u7UGcv2bh82vlpjKQ=; b=QLPSZCB44mV+3XvGtiWzbmcwMVrZDkPaLCQhp4ge5rWFIUnVqhU59TqO37s3A6GYqD GxPK/aoWDCFVor5qsfmqgKm20GPVwHR0DJKO6iHVrbWvZPY7D3f1cijqzS5YDVh74+6D z1x080GqYx+Vt3lI/gZVVRz4hk2G38eRbXof5zT60JL2qmPbA4Ld+gYurZuQiWdYvVH0 aYMY+IWI/mAiee/aLji1xGfmmXKbMVkJUTn50l/yIWPi6HkwESersS4YKBSRjRB60qZr WsCkYpBDwe2ZdzXz4Y9r4/8IrUW/FRq/ZGr/DZMsUyLH9CSeRUF4YANYKONtkhH/2ujf K44g== 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=hmZXcG40f0yJJFflewfqCQj9P+u7UGcv2bh82vlpjKQ=; b=hQ6xNkmWhezLUa7+Ffn92u23Qooufugbtb0mNDXSearYaUHuI6EwIUcJfpudb5WEr5 FaZ/wwyD88xZvig8YRssu7c0i1AEVbQxxTXDPziYrUYsCoLQPYBUFIMEAriwk3PPCr1O IzdQT/pwdAuGSKr/+DJxZhK0XdTNJUzSC+lOZU3YXEfbBsS+N2ivdo835ZldfMpowWkB tIbbwnc1qxH4HANZvvDukNADmOy2R5uJJGEBU67tGpJrwTkEPaDsBw9p65IXFezaDcCh DlLpdr/8DB1V9Z97mgjONgy0he7WV5/EVyh0Q4XCjDwM3uIsHtriftNHspYeUJPu9vdL uZ4g== X-Gm-Message-State: AOAM532blDOGT6k3xANtSvCDDhiM2G5/re+zFbmSfD6405+U5TENYPut juE4wDtYM+frlwfyvvqFqHCmh7sK8rg58Q== X-Google-Smtp-Source: ABdhPJydxRUNzCIiL3Sw82GYD+PKiJO7F8NC6PitNW9EfRt+4xhjsYwCD6M1iJc0EsyncMkRKy43dg== X-Received: by 2002:a62:7c87:: with SMTP id x129mr51189pfc.165.1597963833055; Thu, 20 Aug 2020 15:50:33 -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.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:31 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:45 -0700 Message-Id: <1597963790-12362-19-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 18/23] 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 877c8bd..deffb3a 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: