netlink: make validation more configurable for future strictness
We currently have two levels of strict validation:
1) liberal (default)
- undefined (type >= max) & NLA_UNSPEC attributes accepted
- attribute length >= expected accepted
- garbage at end of message accepted
2) strict (opt-in)
- NLA_UNSPEC attributes accepted
- attribute length >= expected accepted
Split out parsing strictness into four different options:
* TRAILING - check that there's no trailing data after parsing
attributes (in message or nested)
* MAXTYPE - reject attrs > max known type
* UNSPEC - reject attributes with NLA_UNSPEC policy entries
* STRICT_ATTRS - strictly validate attribute size
The default for future things should be *everything*.
The current *_strict() is a combination of TRAILING and MAXTYPE,
and is renamed to _deprecated_strict().
The current regular parsing has none of this, and is renamed to
*_parse_deprecated().
Additionally it allows us to selectively set one of the new flags
even on old policies. Notably, the UNSPEC flag could be useful in
this case, since it can be arranged (by filling in the policy) to
not be an incompatible userspace ABI change, but would then going
forward prevent forgetting attribute entries. Similar can apply
to the POLICY flag.
We end up with the following renames:
* nla_parse -> nla_parse_deprecated
* nla_parse_strict -> nla_parse_deprecated_strict
* nlmsg_parse -> nlmsg_parse_deprecated
* nlmsg_parse_strict -> nlmsg_parse_deprecated_strict
* nla_parse_nested -> nla_parse_nested_deprecated
* nla_validate_nested -> nla_validate_nested_deprecated
Using spatch, of course:
@@
expression TB, MAX, HEAD, LEN, POL, EXT;
@@
-nla_parse(TB, MAX, HEAD, LEN, POL, EXT)
+nla_parse_deprecated(TB, MAX, HEAD, LEN, POL, EXT)
@@
expression NLH, HDRLEN, TB, MAX, POL, EXT;
@@
-nlmsg_parse(NLH, HDRLEN, TB, MAX, POL, EXT)
+nlmsg_parse_deprecated(NLH, HDRLEN, TB, MAX, POL, EXT)
@@
expression NLH, HDRLEN, TB, MAX, POL, EXT;
@@
-nlmsg_parse_strict(NLH, HDRLEN, TB, MAX, POL, EXT)
+nlmsg_parse_deprecated_strict(NLH, HDRLEN, TB, MAX, POL, EXT)
@@
expression TB, MAX, NLA, POL, EXT;
@@
-nla_parse_nested(TB, MAX, NLA, POL, EXT)
+nla_parse_nested_deprecated(TB, MAX, NLA, POL, EXT)
@@
expression START, MAX, POL, EXT;
@@
-nla_validate_nested(START, MAX, POL, EXT)
+nla_validate_nested_deprecated(START, MAX, POL, EXT)
@@
expression NLH, HDRLEN, MAX, POL, EXT;
@@
-nlmsg_validate(NLH, HDRLEN, MAX, POL, EXT)
+nlmsg_validate_deprecated(NLH, HDRLEN, MAX, POL, EXT)
For this patch, don't actually add the strict, non-renamed versions
yet so that it breaks compile if I get it wrong.
Also, while at it, make nla_validate and nla_parse go down to a
common __nla_validate_parse() function to avoid code duplication.
Ultimately, this allows us to have very strict validation for every
new caller of nla_parse()/nlmsg_parse() etc as re-introduced in the
next patch, while existing things will continue to work as is.
In effect then, this adds fully strict validation for any new command.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
6f455f5f4e
commit
8cb081746c
@@ -776,9 +776,9 @@ int tipc_nl_bearer_get(struct sk_buff *skb, struct genl_info *info)
|
||||
if (!info->attrs[TIPC_NLA_BEARER])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX,
|
||||
info->attrs[TIPC_NLA_BEARER],
|
||||
tipc_nl_bearer_policy, info->extack);
|
||||
err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX,
|
||||
info->attrs[TIPC_NLA_BEARER],
|
||||
tipc_nl_bearer_policy, info->extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -825,9 +825,9 @@ int __tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info)
|
||||
if (!info->attrs[TIPC_NLA_BEARER])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX,
|
||||
info->attrs[TIPC_NLA_BEARER],
|
||||
tipc_nl_bearer_policy, info->extack);
|
||||
err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX,
|
||||
info->attrs[TIPC_NLA_BEARER],
|
||||
tipc_nl_bearer_policy, info->extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -870,9 +870,9 @@ int __tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info)
|
||||
if (!info->attrs[TIPC_NLA_BEARER])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX,
|
||||
info->attrs[TIPC_NLA_BEARER],
|
||||
tipc_nl_bearer_policy, info->extack);
|
||||
err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX,
|
||||
info->attrs[TIPC_NLA_BEARER],
|
||||
tipc_nl_bearer_policy, info->extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -921,9 +921,9 @@ int tipc_nl_bearer_add(struct sk_buff *skb, struct genl_info *info)
|
||||
if (!info->attrs[TIPC_NLA_BEARER])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX,
|
||||
info->attrs[TIPC_NLA_BEARER],
|
||||
tipc_nl_bearer_policy, info->extack);
|
||||
err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX,
|
||||
info->attrs[TIPC_NLA_BEARER],
|
||||
tipc_nl_bearer_policy, info->extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -964,9 +964,9 @@ int __tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info)
|
||||
if (!info->attrs[TIPC_NLA_BEARER])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX,
|
||||
info->attrs[TIPC_NLA_BEARER],
|
||||
tipc_nl_bearer_policy, info->extack);
|
||||
err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX,
|
||||
info->attrs[TIPC_NLA_BEARER],
|
||||
tipc_nl_bearer_policy, info->extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -1107,9 +1107,9 @@ int tipc_nl_media_get(struct sk_buff *skb, struct genl_info *info)
|
||||
if (!info->attrs[TIPC_NLA_MEDIA])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(attrs, TIPC_NLA_MEDIA_MAX,
|
||||
info->attrs[TIPC_NLA_MEDIA],
|
||||
tipc_nl_media_policy, info->extack);
|
||||
err = nla_parse_nested_deprecated(attrs, TIPC_NLA_MEDIA_MAX,
|
||||
info->attrs[TIPC_NLA_MEDIA],
|
||||
tipc_nl_media_policy, info->extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -1155,9 +1155,9 @@ int __tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info)
|
||||
if (!info->attrs[TIPC_NLA_MEDIA])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(attrs, TIPC_NLA_MEDIA_MAX,
|
||||
info->attrs[TIPC_NLA_MEDIA],
|
||||
tipc_nl_media_policy, info->extack);
|
||||
err = nla_parse_nested_deprecated(attrs, TIPC_NLA_MEDIA_MAX,
|
||||
info->attrs[TIPC_NLA_MEDIA],
|
||||
tipc_nl_media_policy, info->extack);
|
||||
|
||||
if (!attrs[TIPC_NLA_MEDIA_NAME])
|
||||
return -EINVAL;
|
||||
|
||||
@@ -2148,8 +2148,8 @@ int tipc_nl_parse_link_prop(struct nlattr *prop, struct nlattr *props[])
|
||||
{
|
||||
int err;
|
||||
|
||||
err = nla_parse_nested(props, TIPC_NLA_PROP_MAX, prop,
|
||||
tipc_nl_prop_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(props, TIPC_NLA_PROP_MAX, prop,
|
||||
tipc_nl_prop_policy, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
||||
@@ -245,9 +245,9 @@ int __tipc_nl_net_set(struct sk_buff *skb, struct genl_info *info)
|
||||
if (!info->attrs[TIPC_NLA_NET])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(attrs, TIPC_NLA_NET_MAX,
|
||||
info->attrs[TIPC_NLA_NET], tipc_nl_net_policy,
|
||||
info->extack);
|
||||
err = nla_parse_nested_deprecated(attrs, TIPC_NLA_NET_MAX,
|
||||
info->attrs[TIPC_NLA_NET],
|
||||
tipc_nl_net_policy, info->extack);
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -255,8 +255,8 @@ int tipc_nlmsg_parse(const struct nlmsghdr *nlh, struct nlattr ***attr)
|
||||
if (!*attr)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return nlmsg_parse(nlh, GENL_HDRLEN, *attr, maxattr, tipc_nl_policy,
|
||||
NULL);
|
||||
return nlmsg_parse_deprecated(nlh, GENL_HDRLEN, *attr, maxattr,
|
||||
tipc_nl_policy, NULL);
|
||||
}
|
||||
|
||||
int __init tipc_netlink_start(void)
|
||||
|
||||
@@ -328,9 +328,9 @@ static int __tipc_nl_compat_doit(struct tipc_nl_compat_cmd_doit *cmd,
|
||||
if (err)
|
||||
goto doit_out;
|
||||
|
||||
err = nla_parse(attrbuf, tipc_genl_family.maxattr,
|
||||
(const struct nlattr *)trans_buf->data,
|
||||
trans_buf->len, NULL, NULL);
|
||||
err = nla_parse_deprecated(attrbuf, tipc_genl_family.maxattr,
|
||||
(const struct nlattr *)trans_buf->data,
|
||||
trans_buf->len, NULL, NULL);
|
||||
if (err)
|
||||
goto doit_out;
|
||||
|
||||
@@ -378,8 +378,8 @@ static int tipc_nl_compat_bearer_dump(struct tipc_nl_compat_msg *msg,
|
||||
if (!attrs[TIPC_NLA_BEARER])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(bearer, TIPC_NLA_BEARER_MAX,
|
||||
attrs[TIPC_NLA_BEARER], NULL, NULL);
|
||||
err = nla_parse_nested_deprecated(bearer, TIPC_NLA_BEARER_MAX,
|
||||
attrs[TIPC_NLA_BEARER], NULL, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -514,24 +514,26 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg,
|
||||
if (!attrs[TIPC_NLA_LINK])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(link, TIPC_NLA_LINK_MAX, attrs[TIPC_NLA_LINK],
|
||||
NULL, NULL);
|
||||
err = nla_parse_nested_deprecated(link, TIPC_NLA_LINK_MAX,
|
||||
attrs[TIPC_NLA_LINK], NULL, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (!link[TIPC_NLA_LINK_PROP])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(prop, TIPC_NLA_PROP_MAX,
|
||||
link[TIPC_NLA_LINK_PROP], NULL, NULL);
|
||||
err = nla_parse_nested_deprecated(prop, TIPC_NLA_PROP_MAX,
|
||||
link[TIPC_NLA_LINK_PROP], NULL,
|
||||
NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (!link[TIPC_NLA_LINK_STATS])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(stats, TIPC_NLA_STATS_MAX,
|
||||
link[TIPC_NLA_LINK_STATS], NULL, NULL);
|
||||
err = nla_parse_nested_deprecated(stats, TIPC_NLA_STATS_MAX,
|
||||
link[TIPC_NLA_LINK_STATS], NULL,
|
||||
NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -645,8 +647,8 @@ static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg,
|
||||
if (!attrs[TIPC_NLA_LINK])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(link, TIPC_NLA_LINK_MAX, attrs[TIPC_NLA_LINK],
|
||||
NULL, NULL);
|
||||
err = nla_parse_nested_deprecated(link, TIPC_NLA_LINK_MAX,
|
||||
attrs[TIPC_NLA_LINK], NULL, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -869,16 +871,18 @@ static int tipc_nl_compat_name_table_dump(struct tipc_nl_compat_msg *msg,
|
||||
if (!attrs[TIPC_NLA_NAME_TABLE])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(nt, TIPC_NLA_NAME_TABLE_MAX,
|
||||
attrs[TIPC_NLA_NAME_TABLE], NULL, NULL);
|
||||
err = nla_parse_nested_deprecated(nt, TIPC_NLA_NAME_TABLE_MAX,
|
||||
attrs[TIPC_NLA_NAME_TABLE], NULL,
|
||||
NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (!nt[TIPC_NLA_NAME_TABLE_PUBL])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(publ, TIPC_NLA_PUBL_MAX,
|
||||
nt[TIPC_NLA_NAME_TABLE_PUBL], NULL, NULL);
|
||||
err = nla_parse_nested_deprecated(publ, TIPC_NLA_PUBL_MAX,
|
||||
nt[TIPC_NLA_NAME_TABLE_PUBL], NULL,
|
||||
NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -937,8 +941,8 @@ static int __tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg,
|
||||
if (!attrs[TIPC_NLA_PUBL])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(publ, TIPC_NLA_PUBL_MAX, attrs[TIPC_NLA_PUBL],
|
||||
NULL, NULL);
|
||||
err = nla_parse_nested_deprecated(publ, TIPC_NLA_PUBL_MAX,
|
||||
attrs[TIPC_NLA_PUBL], NULL, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -1007,8 +1011,8 @@ static int tipc_nl_compat_sk_dump(struct tipc_nl_compat_msg *msg,
|
||||
if (!attrs[TIPC_NLA_SOCK])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(sock, TIPC_NLA_SOCK_MAX, attrs[TIPC_NLA_SOCK],
|
||||
NULL, NULL);
|
||||
err = nla_parse_nested_deprecated(sock, TIPC_NLA_SOCK_MAX,
|
||||
attrs[TIPC_NLA_SOCK], NULL, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -1019,8 +1023,9 @@ static int tipc_nl_compat_sk_dump(struct tipc_nl_compat_msg *msg,
|
||||
u32 node;
|
||||
struct nlattr *con[TIPC_NLA_CON_MAX + 1];
|
||||
|
||||
err = nla_parse_nested(con, TIPC_NLA_CON_MAX,
|
||||
sock[TIPC_NLA_SOCK_CON], NULL, NULL);
|
||||
err = nla_parse_nested_deprecated(con, TIPC_NLA_CON_MAX,
|
||||
sock[TIPC_NLA_SOCK_CON],
|
||||
NULL, NULL);
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
@@ -1059,8 +1064,8 @@ static int tipc_nl_compat_media_dump(struct tipc_nl_compat_msg *msg,
|
||||
if (!attrs[TIPC_NLA_MEDIA])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(media, TIPC_NLA_MEDIA_MAX,
|
||||
attrs[TIPC_NLA_MEDIA], NULL, NULL);
|
||||
err = nla_parse_nested_deprecated(media, TIPC_NLA_MEDIA_MAX,
|
||||
attrs[TIPC_NLA_MEDIA], NULL, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -1079,8 +1084,8 @@ static int tipc_nl_compat_node_dump(struct tipc_nl_compat_msg *msg,
|
||||
if (!attrs[TIPC_NLA_NODE])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(node, TIPC_NLA_NODE_MAX, attrs[TIPC_NLA_NODE],
|
||||
NULL, NULL);
|
||||
err = nla_parse_nested_deprecated(node, TIPC_NLA_NODE_MAX,
|
||||
attrs[TIPC_NLA_NODE], NULL, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -1126,8 +1131,8 @@ static int tipc_nl_compat_net_dump(struct tipc_nl_compat_msg *msg,
|
||||
if (!attrs[TIPC_NLA_NET])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(net, TIPC_NLA_NET_MAX, attrs[TIPC_NLA_NET],
|
||||
NULL, NULL);
|
||||
err = nla_parse_nested_deprecated(net, TIPC_NLA_NET_MAX,
|
||||
attrs[TIPC_NLA_NET], NULL, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
||||
@@ -1885,9 +1885,9 @@ int tipc_nl_peer_rm(struct sk_buff *skb, struct genl_info *info)
|
||||
if (!info->attrs[TIPC_NLA_NET])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(attrs, TIPC_NLA_NET_MAX,
|
||||
info->attrs[TIPC_NLA_NET], tipc_nl_net_policy,
|
||||
info->extack);
|
||||
err = nla_parse_nested_deprecated(attrs, TIPC_NLA_NET_MAX,
|
||||
info->attrs[TIPC_NLA_NET],
|
||||
tipc_nl_net_policy, info->extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -2043,9 +2043,9 @@ int tipc_nl_node_set_link(struct sk_buff *skb, struct genl_info *info)
|
||||
if (!info->attrs[TIPC_NLA_LINK])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(attrs, TIPC_NLA_LINK_MAX,
|
||||
info->attrs[TIPC_NLA_LINK],
|
||||
tipc_nl_link_policy, info->extack);
|
||||
err = nla_parse_nested_deprecated(attrs, TIPC_NLA_LINK_MAX,
|
||||
info->attrs[TIPC_NLA_LINK],
|
||||
tipc_nl_link_policy, info->extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -2119,9 +2119,9 @@ int tipc_nl_node_get_link(struct sk_buff *skb, struct genl_info *info)
|
||||
if (!info->attrs[TIPC_NLA_LINK])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(attrs, TIPC_NLA_LINK_MAX,
|
||||
info->attrs[TIPC_NLA_LINK],
|
||||
tipc_nl_link_policy, info->extack);
|
||||
err = nla_parse_nested_deprecated(attrs, TIPC_NLA_LINK_MAX,
|
||||
info->attrs[TIPC_NLA_LINK],
|
||||
tipc_nl_link_policy, info->extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -2184,9 +2184,9 @@ int tipc_nl_node_reset_link_stats(struct sk_buff *skb, struct genl_info *info)
|
||||
if (!info->attrs[TIPC_NLA_LINK])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(attrs, TIPC_NLA_LINK_MAX,
|
||||
info->attrs[TIPC_NLA_LINK],
|
||||
tipc_nl_link_policy, info->extack);
|
||||
err = nla_parse_nested_deprecated(attrs, TIPC_NLA_LINK_MAX,
|
||||
info->attrs[TIPC_NLA_LINK],
|
||||
tipc_nl_link_policy, info->extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -2324,9 +2324,10 @@ int tipc_nl_node_set_monitor(struct sk_buff *skb, struct genl_info *info)
|
||||
if (!info->attrs[TIPC_NLA_MON])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(attrs, TIPC_NLA_MON_MAX,
|
||||
info->attrs[TIPC_NLA_MON],
|
||||
tipc_nl_monitor_policy, info->extack);
|
||||
err = nla_parse_nested_deprecated(attrs, TIPC_NLA_MON_MAX,
|
||||
info->attrs[TIPC_NLA_MON],
|
||||
tipc_nl_monitor_policy,
|
||||
info->extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -2444,9 +2445,10 @@ int tipc_nl_node_dump_monitor_peer(struct sk_buff *skb,
|
||||
if (!attrs[TIPC_NLA_MON])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(mon, TIPC_NLA_MON_MAX,
|
||||
attrs[TIPC_NLA_MON],
|
||||
tipc_nl_monitor_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(mon, TIPC_NLA_MON_MAX,
|
||||
attrs[TIPC_NLA_MON],
|
||||
tipc_nl_monitor_policy,
|
||||
NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
||||
@@ -3599,9 +3599,9 @@ int tipc_nl_publ_dump(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
if (!attrs[TIPC_NLA_SOCK])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(sock, TIPC_NLA_SOCK_MAX,
|
||||
attrs[TIPC_NLA_SOCK],
|
||||
tipc_nl_sock_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(sock, TIPC_NLA_SOCK_MAX,
|
||||
attrs[TIPC_NLA_SOCK],
|
||||
tipc_nl_sock_policy, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
||||
@@ -447,9 +447,9 @@ int tipc_udp_nl_dump_remoteip(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
if (!attrs[TIPC_NLA_BEARER])
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(battrs, TIPC_NLA_BEARER_MAX,
|
||||
attrs[TIPC_NLA_BEARER],
|
||||
tipc_nl_bearer_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(battrs, TIPC_NLA_BEARER_MAX,
|
||||
attrs[TIPC_NLA_BEARER],
|
||||
tipc_nl_bearer_policy, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -601,8 +601,7 @@ int tipc_udp_nl_bearer_add(struct tipc_bearer *b, struct nlattr *attr)
|
||||
struct nlattr *opts[TIPC_NLA_UDP_MAX + 1];
|
||||
struct udp_media_addr *dst;
|
||||
|
||||
if (nla_parse_nested(opts, TIPC_NLA_UDP_MAX, attr,
|
||||
tipc_nl_udp_policy, NULL))
|
||||
if (nla_parse_nested_deprecated(opts, TIPC_NLA_UDP_MAX, attr, tipc_nl_udp_policy, NULL))
|
||||
return -EINVAL;
|
||||
|
||||
if (!opts[TIPC_NLA_UDP_REMOTE])
|
||||
@@ -655,9 +654,7 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
|
||||
if (!attrs[TIPC_NLA_BEARER_UDP_OPTS])
|
||||
goto err;
|
||||
|
||||
if (nla_parse_nested(opts, TIPC_NLA_UDP_MAX,
|
||||
attrs[TIPC_NLA_BEARER_UDP_OPTS],
|
||||
tipc_nl_udp_policy, NULL))
|
||||
if (nla_parse_nested_deprecated(opts, TIPC_NLA_UDP_MAX, attrs[TIPC_NLA_BEARER_UDP_OPTS], tipc_nl_udp_policy, NULL))
|
||||
goto err;
|
||||
|
||||
if (!opts[TIPC_NLA_UDP_LOCAL] || !opts[TIPC_NLA_UDP_REMOTE]) {
|
||||
|
||||
Reference in New Issue
Block a user