From patchwork Wed Apr 27 15:53:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dichtel X-Patchwork-Id: 615725 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3qw4Jb0rl3z9s5Q for ; Thu, 28 Apr 2016 01:54:07 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753106AbcD0Pxp (ORCPT ); Wed, 27 Apr 2016 11:53:45 -0400 Received: from host.76.145.23.62.rev.coltfrance.com ([62.23.145.76]:57646 "EHLO proxy.6wind.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750785AbcD0Pxo (ORCPT ); Wed, 27 Apr 2016 11:53:44 -0400 Received: from elsass.dev.6wind.com (unknown [10.16.0.149]) by proxy.6wind.com (Postfix) with ESMTPS id 05AEC25335; Wed, 27 Apr 2016 17:51:58 +0200 (CEST) Received: from root by elsass.dev.6wind.com with local (Exim 4.80) (envelope-from ) id 1avRmG-0000zu-B1; Wed, 27 Apr 2016 17:53:24 +0200 From: Nicolas Dichtel To: bsingharora@gmail.com Cc: netdev@vger.kernel.org, davem@davemloft.net, linux-kernel@vger.kernel.org, linux-wpan@vger.kernel.org, aar@pengutronix.de, pablo@netfilter.org, kaber@trash.net, kadlec@blackhole.kfki.hu, pshelar@nicira.com, kuznet@ms2.inr.ac.ru, jmorris@namei.org, yoshfuji@linux-ipv6.org, netfilter-devel@vger.kernel.org, dev@openvswitch.org, steffen.klassert@secunet.com, herbert@gondor.apana.org.au, Nicolas Dichtel Subject: [PATCH net-next v2] taskstats: fix nl parsing in accounting/getdelays.c Date: Wed, 27 Apr 2016 17:53:08 +0200 Message-Id: <1461772388-3763-1-git-send-email-nicolas.dichtel@6wind.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <5720DFA1.3080503@6wind.com> References: <5720DFA1.3080503@6wind.com> Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org The type TASKSTATS_TYPE_NULL should always be ignored. When jumping to the next attribute, only the length of the current attribute should be added, not the length of all nested attributes. This last bug was not visible before commit 80df554275c2, because the kernel didn't put more than two nested attributes. Fixes: a3baf649ca9c ("[PATCH] per-task-delay-accounting: documentation") Fixes: 80df554275c2 ("taskstats: use the libnl API to align nlattr on 64-bit") Signed-off-by: Nicolas Dichtel --- Documentation/accounting/getdelays.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c index 7785fb5eb93f..b5ca536e56a8 100644 --- a/Documentation/accounting/getdelays.c +++ b/Documentation/accounting/getdelays.c @@ -505,6 +505,8 @@ int main(int argc, char *argv[]) if (!loop) goto done; break; + case TASKSTATS_TYPE_NULL: + break; default: fprintf(stderr, "Unknown nested" " nla_type %d\n", @@ -512,7 +514,8 @@ int main(int argc, char *argv[]) break; } len2 += NLA_ALIGN(na->nla_len); - na = (struct nlattr *) ((char *) na + len2); + na = (struct nlattr *)((char *)na + + NLA_ALIGN(na->nla_len)); } break;