From 160da9e7b055041ab1980b2bb5ed103bd2f77fac Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 23 May 2008 00:05:14 -0700 Subject: [PATCH] --- yaml --- r: 97374 b: refs/heads/master c: 7bece8155be133cd67c41eed2b31c60a310609de h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/net/netlink.h | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 7608a1d779ef..fe8d86dba8e0 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: bdefff1f54cb76a19700663f211350de2f65cc91 +refs/heads/master: 7bece8155be133cd67c41eed2b31c60a310609de diff --git a/trunk/include/net/netlink.h b/trunk/include/net/netlink.h index a5506c42f03c..112dcdf7e34e 100644 --- a/trunk/include/net/netlink.h +++ b/trunk/include/net/netlink.h @@ -772,12 +772,13 @@ static inline int __nla_parse_nested_compat(struct nlattr *tb[], int maxtype, const struct nla_policy *policy, int len) { - if (nla_len(nla) < len) + int nested_len = nla_len(nla) - NLA_ALIGN(len); + + if (nested_len < 0) return -1; - if (nla_len(nla) >= NLA_ALIGN(len) + sizeof(struct nlattr)) - return nla_parse_nested(tb, maxtype, - nla_data(nla) + NLA_ALIGN(len), - policy); + if (nested_len >= nla_attr_size(0)) + return nla_parse(tb, maxtype, nla_data(nla) + NLA_ALIGN(len), + nested_len, policy); memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); return 0; }