aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/netlink.h4
-rw-r--r--net/netlink/attr.c5
2 files changed, 8 insertions, 1 deletions
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 1c11518fc822..2e4c90a98a7f 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -171,6 +171,7 @@ enum {
171 NLA_MSECS, 171 NLA_MSECS,
172 NLA_NESTED, 172 NLA_NESTED,
173 NLA_NUL_STRING, 173 NLA_NUL_STRING,
174 NLA_BINARY,
174 __NLA_TYPE_MAX, 175 __NLA_TYPE_MAX,
175}; 176};
176 177
@@ -188,12 +189,13 @@ enum {
188 * NLA_STRING Maximum length of string 189 * NLA_STRING Maximum length of string
189 * NLA_NUL_STRING Maximum length of string (excluding NUL) 190 * NLA_NUL_STRING Maximum length of string (excluding NUL)
190 * NLA_FLAG Unused 191 * NLA_FLAG Unused
192 * NLA_BINARY Maximum length of attribute payload
191 * All other Exact length of attribute payload 193 * All other Exact length of attribute payload
192 * 194 *
193 * Example: 195 * Example:
194 * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { 196 * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = {
195 * [ATTR_FOO] = { .type = NLA_U16 }, 197 * [ATTR_FOO] = { .type = NLA_U16 },
196 * [ATTR_BAR] = { .type = NLA_STRING, len = BARSIZ }, 198 * [ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ },
197 * [ATTR_BAZ] = { .len = sizeof(struct mystruct) }, 199 * [ATTR_BAZ] = { .len = sizeof(struct mystruct) },
198 * }; 200 * };
199 */ 201 */
diff --git a/net/netlink/attr.c b/net/netlink/attr.c
index 004139557e09..df5f820a4c32 100644
--- a/net/netlink/attr.c
+++ b/net/netlink/attr.c
@@ -67,6 +67,11 @@ static int validate_nla(struct nlattr *nla, int maxtype,
67 } 67 }
68 break; 68 break;
69 69
70 case NLA_BINARY:
71 if (pt->len && attrlen > pt->len)
72 return -ERANGE;
73 break;
74
70 default: 75 default:
71 if (pt->len) 76 if (pt->len)
72 minlen = pt->len; 77 minlen = pt->len;