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=ham 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 06B04C432C3 for ; Tue, 3 Dec 2019 22:44:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C16D620803 for ; Tue, 3 Dec 2019 22:44:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575413067; bh=4nc2b793i02US26Jb+0CmB1WKy0OktXtWfBgjiIIcAs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=n2OuHIR1H6aCrPoyrCDmiCR6dy9woYcNZDBDk+58AVaApFMuHKnHkA+KBurJS9iRI sPQQYaZTPVe31+duLyHR2NgFhan7rYJrZmTePa9uuL+JGPkf4k1VLqiAS00S2bcrx9 pgMy55wi9eagadYy8tO+uHpTJZXoBnV5hQ4TPZ5A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728933AbfLCWo1 (ORCPT ); Tue, 3 Dec 2019 17:44:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:60438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728800AbfLCWo0 (ORCPT ); Tue, 3 Dec 2019 17:44:26 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 E8215207DD; Tue, 3 Dec 2019 22:44:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575413066; bh=4nc2b793i02US26Jb+0CmB1WKy0OktXtWfBgjiIIcAs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rQ6W31+EA6/9Xo4g/zQ4vMX00y8GPZa2lv18Q7ts6EsgWqit58eg+CFgLMZLK+DTQ KyvTBG9SCehqtlhBFm8v26UNgckEwcWxrxQyYfgoNaj3dCLnncvxSRrlLQNmscDL+i Xp9xdoN97qUejXbBrAA+AozvKiaURbBaEZGR9O/k= 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 5.3 120/135] openvswitch: drop unneeded BUG_ON() in ovs_flow_cmd_build_info() Date: Tue, 3 Dec 2019 23:36:00 +0100 Message-Id: <20191203213044.059974703@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191203213005.828543156@linuxfoundation.org> References: <20191203213005.828543156@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Paolo Abeni [ Upstream commit 8ffeb03fbba3b599690b361467bfd2373e8c450f ] All the callers of ovs_flow_cmd_build_info() already deal with error return code correctly, so we can handle the error condition in a more gracefull way. Still dump a warning to preserve debuggability. v1 -> v2: - clarify the commit message - clean the skb and report the error (DaveM) Fixes: ccb1352e76cf ("net: Add Open vSwitch kernel components.") Signed-off-by: Paolo Abeni Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/openvswitch/datapath.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -883,7 +883,10 @@ static struct sk_buff *ovs_flow_cmd_buil retval = ovs_flow_cmd_fill_info(flow, dp_ifindex, skb, info->snd_portid, info->snd_seq, 0, cmd, ufid_flags); - BUG_ON(retval < 0); + if (WARN_ON_ONCE(retval < 0)) { + kfree_skb(skb); + skb = ERR_PTR(retval); + } return skb; }