From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2744C43603 for ; Wed, 4 Dec 2019 18:00:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 95F8E2081B for ; Wed, 4 Dec 2019 18:00:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482459; bh=D6E+lTK1tEU5IHCx+N0KKIGntPnPuQCl/PHIjqQMbSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=t1E8M8JvEN7OrZd0/6aa334nEoYYqVQPDX4Q83s9LwO5OKmiudZy3JFVbqbDHjmdN nX4/mHnilosVJKMDKMTpapMyfOSfYqXZwErGhQnqQC7h1a2O8jMNXTwDMDHhnD81jZ h6H1Bow6wIAsX4pJBKft7SLmxsoqwMhg9ApUnvQA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729463AbfLDSA6 (ORCPT ); Wed, 4 Dec 2019 13:00:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:40274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729446AbfLDSAx (ORCPT ); Wed, 4 Dec 2019 13:00:53 -0500 Received: from localhost (unknown [217.68.49.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5515920659; Wed, 4 Dec 2019 18:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482452; bh=D6E+lTK1tEU5IHCx+N0KKIGntPnPuQCl/PHIjqQMbSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B6ZcjH3ZOwbG4LOFdEpuTFMqkvnYA1TkCSk0YKp1EItmt5/RyKZUxTYqActdVpNDw rXn9SKpRU9Nb9I3YQ+pWjzUqoojsVjx0qpW9+1T9WJzh1N6JZ1Na8qIFevOfkJJogy uL4zYM9Z7S0gm9fRiC4ynwZFrNDSYGey3vp2zPXw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Abeni , "David S. Miller" Subject: [PATCH 4.4 87/92] openvswitch: remove another BUG_ON() Date: Wed, 4 Dec 2019 18:50:27 +0100 Message-Id: <20191204174335.407863344@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204174327.215426506@linuxfoundation.org> References: <20191204174327.215426506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paolo Abeni [ Upstream commit 8a574f86652a4540a2433946ba826ccb87f398cc ] 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 Signed-off-by: Greg Kroah-Hartman --- net/openvswitch/datapath.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -1325,7 +1325,10 @@ static int ovs_flow_cmd_del(struct sk_bu 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, reply, info); } else { @@ -1333,6 +1336,7 @@ static int ovs_flow_cmd_del(struct sk_bu } } +out_free: ovs_flow_free(flow, true); return 0; unlock: