Skip to content

Commit

Permalink
taskstats: fix nl parsing in accounting/getdelays.c
Browse files Browse the repository at this point in the history
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 80df554, because the
kernel didn't put more than two nested attributes.

Fixes: a3baf64 ("[PATCH] per-task-delay-accounting: documentation")
Fixes: 80df554 ("taskstats: use the libnl API to align nlattr on 64-bit")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
NicolasDichtel authored and davem330 committed Apr 27, 2016
1 parent 0e7dd0c commit 570d8e9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Documentation/accounting/getdelays.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,14 +505,17 @@ 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",
na->nla_type);
break;
}
len2 += NLA_ALIGN(na->nla_len);
na = (struct nlattr *) ((char *) na + len2);
na = (struct nlattr *)((char *)na +
NLA_ALIGN(na->nla_len));
}
break;

Expand Down

0 comments on commit 570d8e9

Please sign in to comment.