Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1389296 > unrolled thread

[PATCH net-next v2] taskstats: fix nl parsing in accounting/getdelays.c

Started byNicolas Dichtel <nicolas.dichtel@6wind.com>
First post2016-04-27 18:00 +0200
Last post2016-04-27 19:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH net-next v2] taskstats: fix nl parsing in accounting/getdelays.c Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-04-27 18:00 +0200
    Re: [PATCH net-next v2] taskstats: fix nl parsing in  accounting/getdelays.c David Miller <davem@davemloft.net> - 2016-04-27 19:00 +0200

#1389296 — [PATCH net-next v2] taskstats: fix nl parsing in accounting/getdelays.c

FromNicolas Dichtel <nicolas.dichtel@6wind.com>
Date2016-04-27 18:00 +0200
Subject[PATCH net-next v2] taskstats: fix nl parsing in accounting/getdelays.c
Message-ID<rsA2E-3Ck-35@gated-at.bofh.it>
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 <nicolas.dichtel@6wind.com>
---
 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;
 
-- 
2.8.1

[toc] | [next] | [standalone]


#1389368 — Re: [PATCH net-next v2] taskstats: fix nl parsing in accounting/getdelays.c

FromDavid Miller <davem@davemloft.net>
Date2016-04-27 19:00 +0200
SubjectRe: [PATCH net-next v2] taskstats: fix nl parsing in accounting/getdelays.c
Message-ID<rsAYG-4mv-9@gated-at.bofh.it>
In reply to#1389296
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Wed, 27 Apr 2016 17:53:08 +0200

> 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 <nicolas.dichtel@6wind.com>

Applied, thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web