From patchwork Mon Sep 11 19:56:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 812575 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xrf0l50VYz9s0Z for ; Tue, 12 Sep 2017 06:00:07 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751470AbdIKT74 (ORCPT ); Mon, 11 Sep 2017 15:59:56 -0400 Received: from smtp07.smtpout.orange.fr ([80.12.242.129]:23283 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751052AbdIKT7z (ORCPT ); Mon, 11 Sep 2017 15:59:55 -0400 Received: from localhost.localdomain ([86.196.182.67]) by mwinf5d13 with ME id 8Kzt1w00A1TfVo603Kztnr; Mon, 11 Sep 2017 21:59:53 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 11 Sep 2017 21:59:53 +0200 X-ME-IP: 86.196.182.67 From: Christophe JAILLET To: pshelar@nicira.com, davem@davemloft.net, xiangxia.m.yue@gmail.com Cc: netdev@vger.kernel.org, dev@openvswitch.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH v2] openvswitch: Fix an error handling path in 'ovs_nla_init_match_and_action()' Date: Mon, 11 Sep 2017 21:56:20 +0200 Message-Id: <20170911195620.17931-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.11.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org All other error handling paths in this function go through the 'error' label. This one should do the same. Fixes: 9cc9a5cb176c ("datapath: Avoid using stack larger than 1024.") Signed-off-by: Christophe JAILLET Acked-by: Pravin B Shelar --- I think that the comment above the function could be improved. It looks like the commit log which has introduced this function. I'm also not sure that commit 9cc9a5cb176c is of any help. It is supposed to remove a warning, and I guess it does. But 'ovs_nla_init_match_and_action()' is called unconditionnaly from 'ovs_flow_cmd_set()'. So even if the stack used by each function is reduced, the overall stack should be the same, if not larger. So this commit sounds like adding a bug where the code was fine and states to fix an issue but, at the best, only hides it. Instead of fixing the code with the proposed patch, reverting the initial commit could also be considered. V2: update Subject line --- net/openvswitch/datapath.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 76cf273a56c7..c3aec6227c91 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -1112,7 +1112,8 @@ static int ovs_nla_init_match_and_action(struct net *net, if (!a[OVS_FLOW_ATTR_KEY]) { OVS_NLERR(log, "Flow key attribute not present in set flow."); - return -EINVAL; + error = -EINVAL; + goto error; } *acts = get_flow_actions(net, a[OVS_FLOW_ATTR_ACTIONS], key,