diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/netlink/attr.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/net/netlink/attr.c b/net/netlink/attr.c index c591212793ee..e4d7bed99c2e 100644 --- a/net/netlink/attr.c +++ b/net/netlink/attr.c | |||
@@ -72,6 +72,17 @@ static int validate_nla(struct nlattr *nla, int maxtype, | |||
72 | return -ERANGE; | 72 | return -ERANGE; |
73 | break; | 73 | break; |
74 | 74 | ||
75 | case NLA_NESTED_COMPAT: | ||
76 | if (attrlen < pt->len) | ||
77 | return -ERANGE; | ||
78 | if (attrlen < NLA_ALIGN(pt->len)) | ||
79 | break; | ||
80 | if (attrlen < NLA_ALIGN(pt->len) + NLA_HDRLEN) | ||
81 | return -ERANGE; | ||
82 | nla = nla_data(nla) + NLA_ALIGN(pt->len); | ||
83 | if (attrlen < NLA_ALIGN(pt->len) + NLA_HDRLEN + nla_len(nla)) | ||
84 | return -ERANGE; | ||
85 | break; | ||
75 | default: | 86 | default: |
76 | if (pt->len) | 87 | if (pt->len) |
77 | minlen = pt->len; | 88 | minlen = pt->len; |