* [patch] fix nla_policy_len to actually _iterate_ over the policy
@ 2011-02-28 20:35 Lars Ellenberg
2011-02-28 20:38 ` David Miller
2011-02-28 21:26 ` [stable] " Greg KH
0 siblings, 2 replies; 3+ messages in thread
From: Lars Ellenberg @ 2011-02-28 20:35 UTC (permalink / raw)
To: linux-kernel
Cc: trivial, Holger Eitzenberger, Patrick McHardy, David S. Miller,
netfilter-devel, stable
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>
diff --git a/lib/nlattr.c b/lib/nlattr.c
index 5021cbc..ac09f22 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])
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch] fix nla_policy_len to actually _iterate_ over the policy
2011-02-28 20:35 [patch] fix nla_policy_len to actually _iterate_ over the policy Lars Ellenberg
@ 2011-02-28 20:38 ` David Miller
2011-02-28 21:26 ` [stable] " Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2011-02-28 20:38 UTC (permalink / raw)
To: lars.ellenberg
Cc: linux-kernel, trivial, holger, kaber, netfilter-devel, stable
From: Lars Ellenberg <lars.ellenberg@linbit.com>
Date: Mon, 28 Feb 2011 21:35:59 +0100
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [stable] [patch] fix nla_policy_len to actually _iterate_ over the policy
2011-02-28 20:35 [patch] fix nla_policy_len to actually _iterate_ over the policy Lars Ellenberg
2011-02-28 20:38 ` David Miller
@ 2011-02-28 21:26 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2011-02-28 21:26 UTC (permalink / raw)
To: Lars Ellenberg
Cc: linux-kernel, trivial, David S. Miller, Patrick McHardy,
netfilter-devel, Holger Eitzenberger, stable
On Mon, Feb 28, 2011 at 09:35:59PM +0100, Lars Ellenberg wrote:
> 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>
>
> diff --git a/lib/nlattr.c b/lib/nlattr.c
Please read how to properly get patches into the stable kernel tree in
the file Documentation/stable_kernel_rules.txt (hint, randomly cc:ing
stable@kernel.org is NOT how to do it...)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-02-28 21:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-28 20:35 [patch] fix nla_policy_len to actually _iterate_ over the policy Lars Ellenberg
2011-02-28 20:38 ` David Miller
2011-02-28 21:26 ` [stable] " Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).