From patchwork Tue Nov 26 12:10:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Abeni X-Patchwork-Id: 1201009 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="ItxUdpKL"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47MjRH3JYCz9sP3 for ; Tue, 26 Nov 2019 23:10:51 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728258AbfKZMKu (ORCPT ); Tue, 26 Nov 2019 07:10:50 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:42814 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727598AbfKZMKt (ORCPT ); Tue, 26 Nov 2019 07:10:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574770248; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bDyE3Rm+4mbLZds5u0BApB4j5+ip47hZxf0KbxNRu2M=; b=ItxUdpKLQ6Or2kmMm0c6SoUmc6gdXsjYRtChgz2c9m5Q02WQNtyrE4A+zvn2catLrCQmMf AZpnql3qHNyxwyNbauOqGm67bWG2qbPgSrs4pd+57A29WECSUMPUSaCei42KQO+mLB4wo7 RNuWfatbDvhwnK8OF4jd71ZcyKMP898= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-267-aIV3a6IXMHu91Szdl6Gviw-1; Tue, 26 Nov 2019 07:10:43 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AC22C800D5A; Tue, 26 Nov 2019 12:10:42 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-191.ams2.redhat.com [10.36.116.191]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCF805D9CA; Tue, 26 Nov 2019 12:10:41 +0000 (UTC) From: Paolo Abeni To: netdev@vger.kernel.org Cc: "David S. Miller" , Pravin B Shelar Subject: [PATCH net 1/2] openvswitch: drop unneeded BUG_ON() in ovs_flow_cmd_build_info() Date: Tue, 26 Nov 2019 13:10:29 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: aIV3a6IXMHu91Szdl6Gviw-1 X-Mimecast-Spam-Score: 0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org All callers already deal with errors correctly, dump a warn instead. Fixes: ccb1352e76cf ("net: Add Open vSwitch kernel components.") Signed-off-by: Paolo Abeni --- net/openvswitch/datapath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index d8c364d637b1..e94f675794f1 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -882,7 +882,7 @@ 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); + WARN_ON_ONCE(retval < 0); return skb; } From patchwork Tue Nov 26 12:10:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Abeni X-Patchwork-Id: 1201010 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="YHXr0fH4"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47MjRJ1YBQz9sPV for ; Tue, 26 Nov 2019 23:10:52 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728254AbfKZMKt (ORCPT ); Tue, 26 Nov 2019 07:10:49 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:28019 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728249AbfKZMKt (ORCPT ); Tue, 26 Nov 2019 07:10:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574770248; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yJ1e0U3GFthJRu3GcyqgiNG7PI5JMmiM2pHw+itKE78=; b=YHXr0fH4GfGkpcAqU8bRxSv8hZqjYGvn+EMHyXpMo/w9FnRQ7Qu9GltzGYeq/pG08bgCNJ zcmLTzW6nSrPFniZGCWTYaV0RMWrmOom6DiaBK9rcEWnCp67jW/vHZOClRIyg3/NjlZxqg u9EcojC9gJ0VGz05Kk0pYBeBR1A7lTk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-165-Q676K3BbNMKS-NcKU8VGzw-1; Tue, 26 Nov 2019 07:10:45 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EF0DE1800D6A; Tue, 26 Nov 2019 12:10:43 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-191.ams2.redhat.com [10.36.116.191]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C3C35D9CA; Tue, 26 Nov 2019 12:10:42 +0000 (UTC) From: Paolo Abeni To: netdev@vger.kernel.org Cc: "David S. Miller" , Pravin B Shelar Subject: [PATCH net 2/2] openvswitch: remove another BUG_ON() Date: Tue, 26 Nov 2019 13:10:30 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: Q676K3BbNMKS-NcKU8VGzw-1 X-Mimecast-Spam-Score: 0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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. Fixes: aed067783e50 ("openvswitch: Minimize ovs_flow_cmd_del critical section.") Signed-off-by: Paolo Abeni --- net/openvswitch/datapath.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index e94f675794f1..50656e807c8c 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -1346,7 +1346,8 @@ 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)) + goto out_free; ovs_notify(&dp_flow_genl_family, reply, info); } else { @@ -1354,6 +1355,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: