aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2019-04-26 08:07:28 -0400
committerDavid S. Miller <davem@davemloft.net>2019-04-27 17:07:21 -0400
commit8cb081746c031fb164089322e2336a0bf5b3070c (patch)
tree1404b16c0859f9d67e67247a10833050c870a3cf /net/tipc
parent6f455f5f4e9c28aefaefbe18ce7304b499645d75 (diff)
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>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/bearer.c42
-rw-r--r--net/tipc/link.c4
-rw-r--r--net/tipc/net.c6
-rw-r--r--net/tipc/netlink.c4
-rw-r--r--net/tipc/netlink_compat.c63
-rw-r--r--net/tipc/node.c38
-rw-r--r--net/tipc/socket.c6
-rw-r--r--net/tipc/udp_media.c13
8 files changed, 90 insertions, 86 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index fd8e4e83f5e0..2bed6589f41e 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -776,9 +776,9 @@ int tipc_nl_bearer_get(struct sk_buff *skb, struct genl_info *info)
776 if (!info->attrs[TIPC_NLA_BEARER]) 776 if (!info->attrs[TIPC_NLA_BEARER])
777 return -EINVAL; 777 return -EINVAL;
778 778
779 err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX, 779 err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX,
780 info->attrs[TIPC_NLA_BEARER], 780 info->attrs[TIPC_NLA_BEARER],
781 tipc_nl_bearer_policy, info->extack); 781 tipc_nl_bearer_policy, info->extack);
782 if (err) 782 if (err)
783 return err; 783 return err;
784 784
@@ -825,9 +825,9 @@ int __tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info)
825 if (!info->attrs[TIPC_NLA_BEARER]) 825 if (!info->attrs[TIPC_NLA_BEARER])
826 return -EINVAL; 826 return -EINVAL;
827 827
828 err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX, 828 err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX,
829 info->attrs[TIPC_NLA_BEARER], 829 info->attrs[TIPC_NLA_BEARER],
830 tipc_nl_bearer_policy, info->extack); 830 tipc_nl_bearer_policy, info->extack);
831 if (err) 831 if (err)
832 return err; 832 return err;
833 833
@@ -870,9 +870,9 @@ int __tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info)
870 if (!info->attrs[TIPC_NLA_BEARER]) 870 if (!info->attrs[TIPC_NLA_BEARER])
871 return -EINVAL; 871 return -EINVAL;
872 872
873 err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX, 873 err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX,
874 info->attrs[TIPC_NLA_BEARER], 874 info->attrs[TIPC_NLA_BEARER],
875 tipc_nl_bearer_policy, info->extack); 875 tipc_nl_bearer_policy, info->extack);
876 if (err) 876 if (err)
877 return err; 877 return err;
878 878
@@ -921,9 +921,9 @@ int tipc_nl_bearer_add(struct sk_buff *skb, struct genl_info *info)
921 if (!info->attrs[TIPC_NLA_BEARER]) 921 if (!info->attrs[TIPC_NLA_BEARER])
922 return -EINVAL; 922 return -EINVAL;
923 923
924 err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX, 924 err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX,
925 info->attrs[TIPC_NLA_BEARER], 925 info->attrs[TIPC_NLA_BEARER],
926 tipc_nl_bearer_policy, info->extack); 926 tipc_nl_bearer_policy, info->extack);
927 if (err) 927 if (err)
928 return err; 928 return err;
929 929
@@ -964,9 +964,9 @@ int __tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info)
964 if (!info->attrs[TIPC_NLA_BEARER]) 964 if (!info->attrs[TIPC_NLA_BEARER])
965 return -EINVAL; 965 return -EINVAL;
966 966
967 err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX, 967 err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX,
968 info->attrs[TIPC_NLA_BEARER], 968 info->attrs[TIPC_NLA_BEARER],
969 tipc_nl_bearer_policy, info->extack); 969 tipc_nl_bearer_policy, info->extack);
970 if (err) 970 if (err)
971 return err; 971 return err;
972 972
@@ -1107,9 +1107,9 @@ int tipc_nl_media_get(struct sk_buff *skb, struct genl_info *info)
1107 if (!info->attrs[TIPC_NLA_MEDIA]) 1107 if (!info->attrs[TIPC_NLA_MEDIA])
1108 return -EINVAL; 1108 return -EINVAL;
1109 1109
1110 err = nla_parse_nested(attrs, TIPC_NLA_MEDIA_MAX, 1110 err = nla_parse_nested_deprecated(attrs, TIPC_NLA_MEDIA_MAX,
1111 info->attrs[TIPC_NLA_MEDIA], 1111 info->attrs[TIPC_NLA_MEDIA],
1112 tipc_nl_media_policy, info->extack); 1112 tipc_nl_media_policy, info->extack);
1113 if (err) 1113 if (err)
1114 return err; 1114 return err;
1115 1115
@@ -1155,9 +1155,9 @@ int __tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info)
1155 if (!info->attrs[TIPC_NLA_MEDIA]) 1155 if (!info->attrs[TIPC_NLA_MEDIA])
1156 return -EINVAL; 1156 return -EINVAL;
1157 1157
1158 err = nla_parse_nested(attrs, TIPC_NLA_MEDIA_MAX, 1158 err = nla_parse_nested_deprecated(attrs, TIPC_NLA_MEDIA_MAX,
1159 info->attrs[TIPC_NLA_MEDIA], 1159 info->attrs[TIPC_NLA_MEDIA],
1160 tipc_nl_media_policy, info->extack); 1160 tipc_nl_media_policy, info->extack);
1161 1161
1162 if (!attrs[TIPC_NLA_MEDIA_NAME]) 1162 if (!attrs[TIPC_NLA_MEDIA_NAME])
1163 return -EINVAL; 1163 return -EINVAL;
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 0327c8ff8d48..1c514b64a0a9 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -2148,8 +2148,8 @@ int tipc_nl_parse_link_prop(struct nlattr *prop, struct nlattr *props[])
2148{ 2148{
2149 int err; 2149 int err;
2150 2150
2151 err = nla_parse_nested(props, TIPC_NLA_PROP_MAX, prop, 2151 err = nla_parse_nested_deprecated(props, TIPC_NLA_PROP_MAX, prop,
2152 tipc_nl_prop_policy, NULL); 2152 tipc_nl_prop_policy, NULL);
2153 if (err) 2153 if (err)
2154 return err; 2154 return err;
2155 2155
diff --git a/net/tipc/net.c b/net/tipc/net.c
index 0bba4e6b005c..85707c185360 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -245,9 +245,9 @@ int __tipc_nl_net_set(struct sk_buff *skb, struct genl_info *info)
245 if (!info->attrs[TIPC_NLA_NET]) 245 if (!info->attrs[TIPC_NLA_NET])
246 return -EINVAL; 246 return -EINVAL;
247 247
248 err = nla_parse_nested(attrs, TIPC_NLA_NET_MAX, 248 err = nla_parse_nested_deprecated(attrs, TIPC_NLA_NET_MAX,
249 info->attrs[TIPC_NLA_NET], tipc_nl_net_policy, 249 info->attrs[TIPC_NLA_NET],
250 info->extack); 250 tipc_nl_net_policy, info->extack);
251 251
252 if (err) 252 if (err)
253 return err; 253 return err;
diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c
index 2d178df0a89f..3d5d0fb5b37c 100644
--- a/net/tipc/netlink.c
+++ b/net/tipc/netlink.c
@@ -255,8 +255,8 @@ int tipc_nlmsg_parse(const struct nlmsghdr *nlh, struct nlattr ***attr)
255 if (!*attr) 255 if (!*attr)
256 return -EOPNOTSUPP; 256 return -EOPNOTSUPP;
257 257
258 return nlmsg_parse(nlh, GENL_HDRLEN, *attr, maxattr, tipc_nl_policy, 258 return nlmsg_parse_deprecated(nlh, GENL_HDRLEN, *attr, maxattr,
259 NULL); 259 tipc_nl_policy, NULL);
260} 260}
261 261
262int __init tipc_netlink_start(void) 262int __init tipc_netlink_start(void)
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index 36fe2dbb6d87..f7269ce934b5 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -328,9 +328,9 @@ static int __tipc_nl_compat_doit(struct tipc_nl_compat_cmd_doit *cmd,
328 if (err) 328 if (err)
329 goto doit_out; 329 goto doit_out;
330 330
331 err = nla_parse(attrbuf, tipc_genl_family.maxattr, 331 err = nla_parse_deprecated(attrbuf, tipc_genl_family.maxattr,
332 (const struct nlattr *)trans_buf->data, 332 (const struct nlattr *)trans_buf->data,
333 trans_buf->len, NULL, NULL); 333 trans_buf->len, NULL, NULL);
334 if (err) 334 if (err)
335 goto doit_out; 335 goto doit_out;
336 336
@@ -378,8 +378,8 @@ static int tipc_nl_compat_bearer_dump(struct tipc_nl_compat_msg *msg,
378 if (!attrs[TIPC_NLA_BEARER]) 378 if (!attrs[TIPC_NLA_BEARER])
379 return -EINVAL; 379 return -EINVAL;
380 380
381 err = nla_parse_nested(bearer, TIPC_NLA_BEARER_MAX, 381 err = nla_parse_nested_deprecated(bearer, TIPC_NLA_BEARER_MAX,
382 attrs[TIPC_NLA_BEARER], NULL, NULL); 382 attrs[TIPC_NLA_BEARER], NULL, NULL);
383 if (err) 383 if (err)
384 return err; 384 return err;
385 385
@@ -514,24 +514,26 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg,
514 if (!attrs[TIPC_NLA_LINK]) 514 if (!attrs[TIPC_NLA_LINK])
515 return -EINVAL; 515 return -EINVAL;
516 516
517 err = nla_parse_nested(link, TIPC_NLA_LINK_MAX, attrs[TIPC_NLA_LINK], 517 err = nla_parse_nested_deprecated(link, TIPC_NLA_LINK_MAX,
518 NULL, NULL); 518 attrs[TIPC_NLA_LINK], NULL, NULL);
519 if (err) 519 if (err)
520 return err; 520 return err;
521 521
522 if (!link[TIPC_NLA_LINK_PROP]) 522 if (!link[TIPC_NLA_LINK_PROP])
523 return -EINVAL; 523 return -EINVAL;
524 524
525 err = nla_parse_nested(prop, TIPC_NLA_PROP_MAX, 525 err = nla_parse_nested_deprecated(prop, TIPC_NLA_PROP_MAX,
526 link[TIPC_NLA_LINK_PROP], NULL, NULL); 526 link[TIPC_NLA_LINK_PROP], NULL,
527 NULL);
527 if (err) 528 if (err)
528 return err; 529 return err;
529 530
530 if (!link[TIPC_NLA_LINK_STATS]) 531 if (!link[TIPC_NLA_LINK_STATS])
531 return -EINVAL; 532 return -EINVAL;
532 533
533 err = nla_parse_nested(stats, TIPC_NLA_STATS_MAX, 534 err = nla_parse_nested_deprecated(stats, TIPC_NLA_STATS_MAX,
534 link[TIPC_NLA_LINK_STATS], NULL, NULL); 535 link[TIPC_NLA_LINK_STATS], NULL,
536 NULL);
535 if (err) 537 if (err)
536 return err; 538 return err;
537 539
@@ -645,8 +647,8 @@ static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg,
645 if (!attrs[TIPC_NLA_LINK]) 647 if (!attrs[TIPC_NLA_LINK])
646 return -EINVAL; 648 return -EINVAL;
647 649
648 err = nla_parse_nested(link, TIPC_NLA_LINK_MAX, attrs[TIPC_NLA_LINK], 650 err = nla_parse_nested_deprecated(link, TIPC_NLA_LINK_MAX,
649 NULL, NULL); 651 attrs[TIPC_NLA_LINK], NULL, NULL);
650 if (err) 652 if (err)
651 return err; 653 return err;
652 654
@@ -869,16 +871,18 @@ static int tipc_nl_compat_name_table_dump(struct tipc_nl_compat_msg *msg,
869 if (!attrs[TIPC_NLA_NAME_TABLE]) 871 if (!attrs[TIPC_NLA_NAME_TABLE])
870 return -EINVAL; 872 return -EINVAL;
871 873
872 err = nla_parse_nested(nt, TIPC_NLA_NAME_TABLE_MAX, 874 err = nla_parse_nested_deprecated(nt, TIPC_NLA_NAME_TABLE_MAX,
873 attrs[TIPC_NLA_NAME_TABLE], NULL, NULL); 875 attrs[TIPC_NLA_NAME_TABLE], NULL,
876 NULL);
874 if (err) 877 if (err)
875 return err; 878 return err;
876 879
877 if (!nt[TIPC_NLA_NAME_TABLE_PUBL]) 880 if (!nt[TIPC_NLA_NAME_TABLE_PUBL])
878 return -EINVAL; 881 return -EINVAL;
879 882
880 err = nla_parse_nested(publ, TIPC_NLA_PUBL_MAX, 883 err = nla_parse_nested_deprecated(publ, TIPC_NLA_PUBL_MAX,
881 nt[TIPC_NLA_NAME_TABLE_PUBL], NULL, NULL); 884 nt[TIPC_NLA_NAME_TABLE_PUBL], NULL,
885 NULL);
882 if (err) 886 if (err)
883 return err; 887 return err;
884 888
@@ -937,8 +941,8 @@ static int __tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg,
937 if (!attrs[TIPC_NLA_PUBL]) 941 if (!attrs[TIPC_NLA_PUBL])
938 return -EINVAL; 942 return -EINVAL;
939 943
940 err = nla_parse_nested(publ, TIPC_NLA_PUBL_MAX, attrs[TIPC_NLA_PUBL], 944 err = nla_parse_nested_deprecated(publ, TIPC_NLA_PUBL_MAX,
941 NULL, NULL); 945 attrs[TIPC_NLA_PUBL], NULL, NULL);
942 if (err) 946 if (err)
943 return err; 947 return err;
944 948
@@ -1007,8 +1011,8 @@ static int tipc_nl_compat_sk_dump(struct tipc_nl_compat_msg *msg,
1007 if (!attrs[TIPC_NLA_SOCK]) 1011 if (!attrs[TIPC_NLA_SOCK])
1008 return -EINVAL; 1012 return -EINVAL;
1009 1013
1010 err = nla_parse_nested(sock, TIPC_NLA_SOCK_MAX, attrs[TIPC_NLA_SOCK], 1014 err = nla_parse_nested_deprecated(sock, TIPC_NLA_SOCK_MAX,
1011 NULL, NULL); 1015 attrs[TIPC_NLA_SOCK], NULL, NULL);
1012 if (err) 1016 if (err)
1013 return err; 1017 return err;
1014 1018
@@ -1019,8 +1023,9 @@ static int tipc_nl_compat_sk_dump(struct tipc_nl_compat_msg *msg,
1019 u32 node; 1023 u32 node;
1020 struct nlattr *con[TIPC_NLA_CON_MAX + 1]; 1024 struct nlattr *con[TIPC_NLA_CON_MAX + 1];
1021 1025
1022 err = nla_parse_nested(con, TIPC_NLA_CON_MAX, 1026 err = nla_parse_nested_deprecated(con, TIPC_NLA_CON_MAX,
1023 sock[TIPC_NLA_SOCK_CON], NULL, NULL); 1027 sock[TIPC_NLA_SOCK_CON],
1028 NULL, NULL);
1024 1029
1025 if (err) 1030 if (err)
1026 return err; 1031 return err;
@@ -1059,8 +1064,8 @@ static int tipc_nl_compat_media_dump(struct tipc_nl_compat_msg *msg,
1059 if (!attrs[TIPC_NLA_MEDIA]) 1064 if (!attrs[TIPC_NLA_MEDIA])
1060 return -EINVAL; 1065 return -EINVAL;
1061 1066
1062 err = nla_parse_nested(media, TIPC_NLA_MEDIA_MAX, 1067 err = nla_parse_nested_deprecated(media, TIPC_NLA_MEDIA_MAX,
1063 attrs[TIPC_NLA_MEDIA], NULL, NULL); 1068 attrs[TIPC_NLA_MEDIA], NULL, NULL);
1064 if (err) 1069 if (err)
1065 return err; 1070 return err;
1066 1071
@@ -1079,8 +1084,8 @@ static int tipc_nl_compat_node_dump(struct tipc_nl_compat_msg *msg,
1079 if (!attrs[TIPC_NLA_NODE]) 1084 if (!attrs[TIPC_NLA_NODE])
1080 return -EINVAL; 1085 return -EINVAL;
1081 1086
1082 err = nla_parse_nested(node, TIPC_NLA_NODE_MAX, attrs[TIPC_NLA_NODE], 1087 err = nla_parse_nested_deprecated(node, TIPC_NLA_NODE_MAX,
1083 NULL, NULL); 1088 attrs[TIPC_NLA_NODE], NULL, NULL);
1084 if (err) 1089 if (err)
1085 return err; 1090 return err;
1086 1091
@@ -1126,8 +1131,8 @@ static int tipc_nl_compat_net_dump(struct tipc_nl_compat_msg *msg,
1126 if (!attrs[TIPC_NLA_NET]) 1131 if (!attrs[TIPC_NLA_NET])
1127 return -EINVAL; 1132 return -EINVAL;
1128 1133
1129 err = nla_parse_nested(net, TIPC_NLA_NET_MAX, attrs[TIPC_NLA_NET], 1134 err = nla_parse_nested_deprecated(net, TIPC_NLA_NET_MAX,
1130 NULL, NULL); 1135 attrs[TIPC_NLA_NET], NULL, NULL);
1131 if (err) 1136 if (err)
1132 return err; 1137 return err;
1133 1138
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 3777254a508f..0eb1bf850219 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -1885,9 +1885,9 @@ int tipc_nl_peer_rm(struct sk_buff *skb, struct genl_info *info)
1885 if (!info->attrs[TIPC_NLA_NET]) 1885 if (!info->attrs[TIPC_NLA_NET])
1886 return -EINVAL; 1886 return -EINVAL;
1887 1887
1888 err = nla_parse_nested(attrs, TIPC_NLA_NET_MAX, 1888 err = nla_parse_nested_deprecated(attrs, TIPC_NLA_NET_MAX,
1889 info->attrs[TIPC_NLA_NET], tipc_nl_net_policy, 1889 info->attrs[TIPC_NLA_NET],
1890 info->extack); 1890 tipc_nl_net_policy, info->extack);
1891 if (err) 1891 if (err)
1892 return err; 1892 return err;
1893 1893
@@ -2043,9 +2043,9 @@ int tipc_nl_node_set_link(struct sk_buff *skb, struct genl_info *info)
2043 if (!info->attrs[TIPC_NLA_LINK]) 2043 if (!info->attrs[TIPC_NLA_LINK])
2044 return -EINVAL; 2044 return -EINVAL;
2045 2045
2046 err = nla_parse_nested(attrs, TIPC_NLA_LINK_MAX, 2046 err = nla_parse_nested_deprecated(attrs, TIPC_NLA_LINK_MAX,
2047 info->attrs[TIPC_NLA_LINK], 2047 info->attrs[TIPC_NLA_LINK],
2048 tipc_nl_link_policy, info->extack); 2048 tipc_nl_link_policy, info->extack);
2049 if (err) 2049 if (err)
2050 return err; 2050 return err;
2051 2051
@@ -2119,9 +2119,9 @@ int tipc_nl_node_get_link(struct sk_buff *skb, struct genl_info *info)
2119 if (!info->attrs[TIPC_NLA_LINK]) 2119 if (!info->attrs[TIPC_NLA_LINK])
2120 return -EINVAL; 2120 return -EINVAL;
2121 2121
2122 err = nla_parse_nested(attrs, TIPC_NLA_LINK_MAX, 2122 err = nla_parse_nested_deprecated(attrs, TIPC_NLA_LINK_MAX,
2123 info->attrs[TIPC_NLA_LINK], 2123 info->attrs[TIPC_NLA_LINK],
2124 tipc_nl_link_policy, info->extack); 2124 tipc_nl_link_policy, info->extack);
2125 if (err) 2125 if (err)
2126 return err; 2126 return err;
2127 2127
@@ -2184,9 +2184,9 @@ int tipc_nl_node_reset_link_stats(struct sk_buff *skb, struct genl_info *info)
2184 if (!info->attrs[TIPC_NLA_LINK]) 2184 if (!info->attrs[TIPC_NLA_LINK])
2185 return -EINVAL; 2185 return -EINVAL;
2186 2186
2187 err = nla_parse_nested(attrs, TIPC_NLA_LINK_MAX, 2187 err = nla_parse_nested_deprecated(attrs, TIPC_NLA_LINK_MAX,
2188 info->attrs[TIPC_NLA_LINK], 2188 info->attrs[TIPC_NLA_LINK],
2189 tipc_nl_link_policy, info->extack); 2189 tipc_nl_link_policy, info->extack);
2190 if (err) 2190 if (err)
2191 return err; 2191 return err;
2192 2192
@@ -2324,9 +2324,10 @@ int tipc_nl_node_set_monitor(struct sk_buff *skb, struct genl_info *info)
2324 if (!info->attrs[TIPC_NLA_MON]) 2324 if (!info->attrs[TIPC_NLA_MON])
2325 return -EINVAL; 2325 return -EINVAL;
2326 2326
2327 err = nla_parse_nested(attrs, TIPC_NLA_MON_MAX, 2327 err = nla_parse_nested_deprecated(attrs, TIPC_NLA_MON_MAX,
2328 info->attrs[TIPC_NLA_MON], 2328 info->attrs[TIPC_NLA_MON],
2329 tipc_nl_monitor_policy, info->extack); 2329 tipc_nl_monitor_policy,
2330 info->extack);
2330 if (err) 2331 if (err)
2331 return err; 2332 return err;
2332 2333
@@ -2444,9 +2445,10 @@ int tipc_nl_node_dump_monitor_peer(struct sk_buff *skb,
2444 if (!attrs[TIPC_NLA_MON]) 2445 if (!attrs[TIPC_NLA_MON])
2445 return -EINVAL; 2446 return -EINVAL;
2446 2447
2447 err = nla_parse_nested(mon, TIPC_NLA_MON_MAX, 2448 err = nla_parse_nested_deprecated(mon, TIPC_NLA_MON_MAX,
2448 attrs[TIPC_NLA_MON], 2449 attrs[TIPC_NLA_MON],
2449 tipc_nl_monitor_policy, NULL); 2450 tipc_nl_monitor_policy,
2451 NULL);
2450 if (err) 2452 if (err)
2451 return err; 2453 return err;
2452 2454
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 7918f4763fdc..145e4decb0c9 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -3599,9 +3599,9 @@ int tipc_nl_publ_dump(struct sk_buff *skb, struct netlink_callback *cb)
3599 if (!attrs[TIPC_NLA_SOCK]) 3599 if (!attrs[TIPC_NLA_SOCK])
3600 return -EINVAL; 3600 return -EINVAL;
3601 3601
3602 err = nla_parse_nested(sock, TIPC_NLA_SOCK_MAX, 3602 err = nla_parse_nested_deprecated(sock, TIPC_NLA_SOCK_MAX,
3603 attrs[TIPC_NLA_SOCK], 3603 attrs[TIPC_NLA_SOCK],
3604 tipc_nl_sock_policy, NULL); 3604 tipc_nl_sock_policy, NULL);
3605 if (err) 3605 if (err)
3606 return err; 3606 return err;
3607 3607
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index 24d7c79598bb..7fc02d84c4f1 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -447,9 +447,9 @@ int tipc_udp_nl_dump_remoteip(struct sk_buff *skb, struct netlink_callback *cb)
447 if (!attrs[TIPC_NLA_BEARER]) 447 if (!attrs[TIPC_NLA_BEARER])
448 return -EINVAL; 448 return -EINVAL;
449 449
450 err = nla_parse_nested(battrs, TIPC_NLA_BEARER_MAX, 450 err = nla_parse_nested_deprecated(battrs, TIPC_NLA_BEARER_MAX,
451 attrs[TIPC_NLA_BEARER], 451 attrs[TIPC_NLA_BEARER],
452 tipc_nl_bearer_policy, NULL); 452 tipc_nl_bearer_policy, NULL);
453 if (err) 453 if (err)
454 return err; 454 return err;
455 455
@@ -601,8 +601,7 @@ int tipc_udp_nl_bearer_add(struct tipc_bearer *b, struct nlattr *attr)
601 struct nlattr *opts[TIPC_NLA_UDP_MAX + 1]; 601 struct nlattr *opts[TIPC_NLA_UDP_MAX + 1];
602 struct udp_media_addr *dst; 602 struct udp_media_addr *dst;
603 603
604 if (nla_parse_nested(opts, TIPC_NLA_UDP_MAX, attr, 604 if (nla_parse_nested_deprecated(opts, TIPC_NLA_UDP_MAX, attr, tipc_nl_udp_policy, NULL))
605 tipc_nl_udp_policy, NULL))
606 return -EINVAL; 605 return -EINVAL;
607 606
608 if (!opts[TIPC_NLA_UDP_REMOTE]) 607 if (!opts[TIPC_NLA_UDP_REMOTE])
@@ -655,9 +654,7 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
655 if (!attrs[TIPC_NLA_BEARER_UDP_OPTS]) 654 if (!attrs[TIPC_NLA_BEARER_UDP_OPTS])
656 goto err; 655 goto err;
657 656
658 if (nla_parse_nested(opts, TIPC_NLA_UDP_MAX, 657 if (nla_parse_nested_deprecated(opts, TIPC_NLA_UDP_MAX, attrs[TIPC_NLA_BEARER_UDP_OPTS], tipc_nl_udp_policy, NULL))
659 attrs[TIPC_NLA_BEARER_UDP_OPTS],
660 tipc_nl_udp_policy, NULL))
661 goto err; 658 goto err;
662 659
663 if (!opts[TIPC_NLA_UDP_LOCAL] || !opts[TIPC_NLA_UDP_REMOTE]) { 660 if (!opts[TIPC_NLA_UDP_LOCAL] || !opts[TIPC_NLA_UDP_REMOTE]) {