Commit e3ab105c authored by Nicolas Dichtel's avatar Nicolas Dichtel Committed by Kamal Mostafa

taskstats: fix nl parsing in accounting/getdelays.c

commit 570d8e93 upstream.

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 80df5542, because the
kernel didn't put more than two nested attributes.

Fixes: a3baf649 ("[PATCH] per-task-delay-accounting: documentation")
Fixes: 80df5542 ("taskstats: use the libnl API to align nlattr on 64-bit")
Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent d25da855
......@@ -504,6 +504,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",
......@@ -511,7 +513,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment