summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ellenberg <lars.ellenberg@linbit.com>2011-02-28 21:38:25 +0100
committerDavid S. Miller <davem@davemloft.net>2011-02-28 21:38:25 +0100
commite3fa3aff0cb198e7c53d894f52146121d9592872 (patch)
tree69746e934e9b4cdff8ae686caafb471770755e73
parentf_phonet: avoid pskb_pull(), fix OOPS with CONFIG_HIGHMEM (diff)
downloadlinux-e3fa3aff0cb198e7c53d894f52146121d9592872.tar.xz
linux-e3fa3aff0cb198e7c53d894f52146121d9592872.zip
net: fix nla_policy_len to actually _iterate_ over the policy
Currently nla_policy_len always returns n * NLA_HDRLEN: It loops, but does not advance it's iterator. NLA_UNSPEC == 0 does not contain a .len in any policy. Trivially fixed by adding p++. Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--lib/nlattr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/nlattr.c b/lib/nlattr.c
index 5021cbc34411..ac09f2226dc7 100644
--- a/lib/nlattr.c
+++ b/lib/nlattr.c
@@ -148,7 +148,7 @@ nla_policy_len(const struct nla_policy *p, int n)
{
int i, len = 0;
- for (i = 0; i < n; i++) {
+ for (i = 0; i < n; i++, p++) {
if (p->len)
len += nla_total_size(p->len);
else if (nla_attr_minlen[p->type])