Received: by 10.192.165.156 with SMTP id m28csp1152317imm; Wed, 11 Apr 2018 13:25:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+2ZuJkpXBxMw0RN9L6MvJO/exJSFwEVnFHEYxEEQZj0WdE6fhCgAiE0jnoFkIQLqOeIJ7B X-Received: by 10.99.103.6 with SMTP id b6mr4526071pgc.214.1523478353813; Wed, 11 Apr 2018 13:25:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523478353; cv=none; d=google.com; s=arc-20160816; b=0SLGFkNMV7ocrn9P6+1bKfa4Z31lDmgUCNJnkyoydy/EMEMgzqD6iSIwwufSY1GZ7s Y0Cn7uOCYbQ4/x9z0eX6TogchGv3PTCysPlvyPLYvQnoUJPrjPyIiGgUx+PU+yXhJPJ4 bL7cW6YKSlBzOYr66Ggwt8jEZmrFJWdM9AvPKkDOzppelEqryENcJxrWOe2EzJiN4Kdf XfelVBnPh4qsPavTthYmjduIUbtf28QcFqmmJb0fopl9Zw1TsQt1VA6c2iailVwZcOYV 1T9tkGUa72Hjjd3xajlI8VzRID0AeDBnDxbXR+yQv2UpaG32gMeaQ0zLExeGoc9KfamJ gv+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=OJUtpGCGTdUHUht3lnAhRKQ9HKP+OTVIIyX6jy8mB1o=; b=Am3tcHSE1rZ8KZCeUv5+S2h7ABSYRswikn+6sLAn5pJZz40v+lN+YqhvjbvF+LYotL kJ/3SZh6CADqWd6P8KunQv/P8Q+LOoEZwFr6DxrvFDtr1ktY/i3XEKgW3s8ikSbe0e8H O6gPqt5jXAgVvDJXVOVtDRbgzcJfIo71bsQvcP+ARSuEK+Qu5f/7/7u1MMUr7YrkdrIS 9Homno62ZLNskXjtIOEEg7Y8AjnPwmj+T/AJ/CLn09w6thAbXpq+Wip+oQjagoTZVcu7 s9IJAoYAhi2wd2jEGD9dCOUXLq39Sr5DS7314WeZTmWHOMf05EPvKT7safrdP2G2A9th uiGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5-v6si1740992pli.364.2018.04.11.13.25.17; Wed, 11 Apr 2018 13:25:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757403AbeDKUUh (ORCPT + 99 others); Wed, 11 Apr 2018 16:20:37 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33246 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932331AbeDKSwE (ORCPT ); Wed, 11 Apr 2018 14:52:04 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BA530E65; Wed, 11 Apr 2018 18:52:03 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Craig Dillabaugh , Jamal Hadi Salim , "David S. Miller" Subject: [PATCH 4.4 187/190] net sched actions: fix dumping which requires several messages to user space Date: Wed, 11 Apr 2018 20:37:13 +0200 Message-Id: <20180411183604.489850959@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183550.114495991@linuxfoundation.org> References: <20180411183550.114495991@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Craig Dillabaugh [ Upstream commit 734549eb550c0c720bc89e50501f1b1e98cdd841 ] Fixes a bug in the tcf_dump_walker function that can cause some actions to not be reported when dumping a large number of actions. This issue became more aggrevated when cookies feature was added. In particular this issue is manifest when large cookie values are assigned to the actions and when enough actions are created that the resulting table must be dumped in multiple batches. The number of actions returned in each batch is limited by the total number of actions and the memory buffer size. With small cookies the numeric limit is reached before the buffer size limit, which avoids the code path triggering this bug. When large cookies are used buffer fills before the numeric limit, and the erroneous code path is hit. For example after creating 32 csum actions with the cookie aaaabbbbccccdddd $ tc actions ls action csum total acts 26 action order 0: csum (tcp) action continue index 1 ref 1 bind 0 cookie aaaabbbbccccdddd ..... action order 25: csum (tcp) action continue index 26 ref 1 bind 0 cookie aaaabbbbccccdddd total acts 6 action order 0: csum (tcp) action continue index 28 ref 1 bind 0 cookie aaaabbbbccccdddd ...... action order 5: csum (tcp) action continue index 32 ref 1 bind 0 cookie aaaabbbbccccdddd Note that the action with index 27 is omitted from the report. Fixes: 4b3550ef530c ("[NET_SCHED]: Use nla_nest_start/nla_nest_end")" Signed-off-by: Craig Dillabaugh Acked-by: Jamal Hadi Salim Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/sched/act_api.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -101,8 +101,10 @@ static int tcf_dump_walker(struct sk_buf a->order = n_i; nest = nla_nest_start(skb, a->order); - if (nest == NULL) + if (nest == NULL) { + index--; goto nla_put_failure; + } err = tcf_action_dump_1(skb, a, 0, 0); if (err < 0) { index--;