diff options
145 files changed, 1233 insertions, 933 deletions
diff --git a/crypto/crypto_user_base.c b/crypto/crypto_user_base.c index f25d3f32c9c2..e48da3b75c71 100644 --- a/crypto/crypto_user_base.c +++ b/crypto/crypto_user_base.c | |||
@@ -465,8 +465,8 @@ static int crypto_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
465 | return err; | 465 | return err; |
466 | } | 466 | } |
467 | 467 | ||
468 | err = nlmsg_parse(nlh, crypto_msg_min[type], attrs, CRYPTOCFGA_MAX, | 468 | err = nlmsg_parse_deprecated(nlh, crypto_msg_min[type], attrs, |
469 | crypto_policy, extack); | 469 | CRYPTOCFGA_MAX, crypto_policy, extack); |
470 | if (err < 0) | 470 | if (err < 0) |
471 | return err; | 471 | return err; |
472 | 472 | ||
diff --git a/drivers/block/drbd/drbd_nla.c b/drivers/block/drbd/drbd_nla.c index 8e261cb5198b..6a09b0b98018 100644 --- a/drivers/block/drbd/drbd_nla.c +++ b/drivers/block/drbd/drbd_nla.c | |||
@@ -35,7 +35,8 @@ int drbd_nla_parse_nested(struct nlattr *tb[], int maxtype, struct nlattr *nla, | |||
35 | 35 | ||
36 | err = drbd_nla_check_mandatory(maxtype, nla); | 36 | err = drbd_nla_check_mandatory(maxtype, nla); |
37 | if (!err) | 37 | if (!err) |
38 | err = nla_parse_nested(tb, maxtype, nla, policy, NULL); | 38 | err = nla_parse_nested_deprecated(tb, maxtype, nla, policy, |
39 | NULL); | ||
39 | 40 | ||
40 | return err; | 41 | return err; |
41 | } | 42 | } |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index cd27f236431d..69dc11f907a3 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -1797,8 +1797,10 @@ again: | |||
1797 | ret = -EINVAL; | 1797 | ret = -EINVAL; |
1798 | goto out; | 1798 | goto out; |
1799 | } | 1799 | } |
1800 | ret = nla_parse_nested(socks, NBD_SOCK_MAX, attr, | 1800 | ret = nla_parse_nested_deprecated(socks, NBD_SOCK_MAX, |
1801 | nbd_sock_policy, info->extack); | 1801 | attr, |
1802 | nbd_sock_policy, | ||
1803 | info->extack); | ||
1802 | if (ret != 0) { | 1804 | if (ret != 0) { |
1803 | printk(KERN_ERR "nbd: error processing sock list\n"); | 1805 | printk(KERN_ERR "nbd: error processing sock list\n"); |
1804 | ret = -EINVAL; | 1806 | ret = -EINVAL; |
@@ -1968,8 +1970,10 @@ static int nbd_genl_reconfigure(struct sk_buff *skb, struct genl_info *info) | |||
1968 | ret = -EINVAL; | 1970 | ret = -EINVAL; |
1969 | goto out; | 1971 | goto out; |
1970 | } | 1972 | } |
1971 | ret = nla_parse_nested(socks, NBD_SOCK_MAX, attr, | 1973 | ret = nla_parse_nested_deprecated(socks, NBD_SOCK_MAX, |
1972 | nbd_sock_policy, info->extack); | 1974 | attr, |
1975 | nbd_sock_policy, | ||
1976 | info->extack); | ||
1973 | if (ret != 0) { | 1977 | if (ret != 0) { |
1974 | printk(KERN_ERR "nbd: error processing sock list\n"); | 1978 | printk(KERN_ERR "nbd: error processing sock list\n"); |
1975 | ret = -EINVAL; | 1979 | ret = -EINVAL; |
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index f5ecb660fe7d..744b6ec0acb0 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c | |||
@@ -86,8 +86,8 @@ static inline bool ib_nl_is_good_ip_resp(const struct nlmsghdr *nlh) | |||
86 | if (nlh->nlmsg_flags & RDMA_NL_LS_F_ERR) | 86 | if (nlh->nlmsg_flags & RDMA_NL_LS_F_ERR) |
87 | return false; | 87 | return false; |
88 | 88 | ||
89 | ret = nla_parse(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh), | 89 | ret = nla_parse_deprecated(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh), |
90 | nlmsg_len(nlh), ib_nl_addr_policy, NULL); | 90 | nlmsg_len(nlh), ib_nl_addr_policy, NULL); |
91 | if (ret) | 91 | if (ret) |
92 | return false; | 92 | return false; |
93 | 93 | ||
diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c index a5d2a20ee697..41929bb83739 100644 --- a/drivers/infiniband/core/iwpm_util.c +++ b/drivers/infiniband/core/iwpm_util.c | |||
@@ -506,14 +506,14 @@ int iwpm_parse_nlmsg(struct netlink_callback *cb, int policy_max, | |||
506 | int ret; | 506 | int ret; |
507 | const char *err_str = ""; | 507 | const char *err_str = ""; |
508 | 508 | ||
509 | ret = nlmsg_validate(cb->nlh, nlh_len, policy_max - 1, nlmsg_policy, | 509 | ret = nlmsg_validate_deprecated(cb->nlh, nlh_len, policy_max - 1, |
510 | NULL); | 510 | nlmsg_policy, NULL); |
511 | if (ret) { | 511 | if (ret) { |
512 | err_str = "Invalid attribute"; | 512 | err_str = "Invalid attribute"; |
513 | goto parse_nlmsg_error; | 513 | goto parse_nlmsg_error; |
514 | } | 514 | } |
515 | ret = nlmsg_parse(cb->nlh, nlh_len, nltb, policy_max - 1, | 515 | ret = nlmsg_parse_deprecated(cb->nlh, nlh_len, nltb, policy_max - 1, |
516 | nlmsg_policy, NULL); | 516 | nlmsg_policy, NULL); |
517 | if (ret) { | 517 | if (ret) { |
518 | err_str = "Unable to parse the nlmsg"; | 518 | err_str = "Unable to parse the nlmsg"; |
519 | goto parse_nlmsg_error; | 519 | goto parse_nlmsg_error; |
diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c index ad189a29cc67..85324012bf07 100644 --- a/drivers/infiniband/core/nldev.c +++ b/drivers/infiniband/core/nldev.c | |||
@@ -608,8 +608,8 @@ static int nldev_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
608 | u32 index; | 608 | u32 index; |
609 | int err; | 609 | int err; |
610 | 610 | ||
611 | err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, | 611 | err = nlmsg_parse_deprecated(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, |
612 | nldev_policy, extack); | 612 | nldev_policy, extack); |
613 | if (err || !tb[RDMA_NLDEV_ATTR_DEV_INDEX]) | 613 | if (err || !tb[RDMA_NLDEV_ATTR_DEV_INDEX]) |
614 | return -EINVAL; | 614 | return -EINVAL; |
615 | 615 | ||
@@ -653,8 +653,8 @@ static int nldev_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
653 | u32 index; | 653 | u32 index; |
654 | int err; | 654 | int err; |
655 | 655 | ||
656 | err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, nldev_policy, | 656 | err = nlmsg_parse_deprecated(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, |
657 | extack); | 657 | nldev_policy, extack); |
658 | if (err || !tb[RDMA_NLDEV_ATTR_DEV_INDEX]) | 658 | if (err || !tb[RDMA_NLDEV_ATTR_DEV_INDEX]) |
659 | return -EINVAL; | 659 | return -EINVAL; |
660 | 660 | ||
@@ -722,8 +722,8 @@ static int nldev_port_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
722 | u32 port; | 722 | u32 port; |
723 | int err; | 723 | int err; |
724 | 724 | ||
725 | err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, | 725 | err = nlmsg_parse_deprecated(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, |
726 | nldev_policy, extack); | 726 | nldev_policy, extack); |
727 | if (err || | 727 | if (err || |
728 | !tb[RDMA_NLDEV_ATTR_DEV_INDEX] || | 728 | !tb[RDMA_NLDEV_ATTR_DEV_INDEX] || |
729 | !tb[RDMA_NLDEV_ATTR_PORT_INDEX]) | 729 | !tb[RDMA_NLDEV_ATTR_PORT_INDEX]) |
@@ -778,8 +778,8 @@ static int nldev_port_get_dumpit(struct sk_buff *skb, | |||
778 | int err; | 778 | int err; |
779 | unsigned int p; | 779 | unsigned int p; |
780 | 780 | ||
781 | err = nlmsg_parse(cb->nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, | 781 | err = nlmsg_parse_deprecated(cb->nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, |
782 | nldev_policy, NULL); | 782 | nldev_policy, NULL); |
783 | if (err || !tb[RDMA_NLDEV_ATTR_DEV_INDEX]) | 783 | if (err || !tb[RDMA_NLDEV_ATTR_DEV_INDEX]) |
784 | return -EINVAL; | 784 | return -EINVAL; |
785 | 785 | ||
@@ -833,8 +833,8 @@ static int nldev_res_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
833 | u32 index; | 833 | u32 index; |
834 | int ret; | 834 | int ret; |
835 | 835 | ||
836 | ret = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, | 836 | ret = nlmsg_parse_deprecated(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, |
837 | nldev_policy, extack); | 837 | nldev_policy, extack); |
838 | if (ret || !tb[RDMA_NLDEV_ATTR_DEV_INDEX]) | 838 | if (ret || !tb[RDMA_NLDEV_ATTR_DEV_INDEX]) |
839 | return -EINVAL; | 839 | return -EINVAL; |
840 | 840 | ||
@@ -982,8 +982,8 @@ static int res_get_common_doit(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
982 | struct sk_buff *msg; | 982 | struct sk_buff *msg; |
983 | int ret; | 983 | int ret; |
984 | 984 | ||
985 | ret = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, | 985 | ret = nlmsg_parse_deprecated(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, |
986 | nldev_policy, extack); | 986 | nldev_policy, extack); |
987 | if (ret || !tb[RDMA_NLDEV_ATTR_DEV_INDEX] || !fe->id || !tb[fe->id]) | 987 | if (ret || !tb[RDMA_NLDEV_ATTR_DEV_INDEX] || !fe->id || !tb[fe->id]) |
988 | return -EINVAL; | 988 | return -EINVAL; |
989 | 989 | ||
@@ -1071,8 +1071,8 @@ static int res_get_common_dumpit(struct sk_buff *skb, | |||
1071 | u32 index, port = 0; | 1071 | u32 index, port = 0; |
1072 | bool filled = false; | 1072 | bool filled = false; |
1073 | 1073 | ||
1074 | err = nlmsg_parse(cb->nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, | 1074 | err = nlmsg_parse_deprecated(cb->nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, |
1075 | nldev_policy, NULL); | 1075 | nldev_policy, NULL); |
1076 | /* | 1076 | /* |
1077 | * Right now, we are expecting the device index to get res information, | 1077 | * Right now, we are expecting the device index to get res information, |
1078 | * but it is possible to extend this code to return all devices in | 1078 | * but it is possible to extend this code to return all devices in |
@@ -1250,8 +1250,8 @@ static int nldev_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1250 | char type[IFNAMSIZ]; | 1250 | char type[IFNAMSIZ]; |
1251 | int err; | 1251 | int err; |
1252 | 1252 | ||
1253 | err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, | 1253 | err = nlmsg_parse_deprecated(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, |
1254 | nldev_policy, extack); | 1254 | nldev_policy, extack); |
1255 | if (err || !tb[RDMA_NLDEV_ATTR_DEV_NAME] || | 1255 | if (err || !tb[RDMA_NLDEV_ATTR_DEV_NAME] || |
1256 | !tb[RDMA_NLDEV_ATTR_LINK_TYPE] || !tb[RDMA_NLDEV_ATTR_NDEV_NAME]) | 1256 | !tb[RDMA_NLDEV_ATTR_LINK_TYPE] || !tb[RDMA_NLDEV_ATTR_NDEV_NAME]) |
1257 | return -EINVAL; | 1257 | return -EINVAL; |
@@ -1294,8 +1294,8 @@ static int nldev_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1294 | u32 index; | 1294 | u32 index; |
1295 | int err; | 1295 | int err; |
1296 | 1296 | ||
1297 | err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, | 1297 | err = nlmsg_parse_deprecated(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, |
1298 | nldev_policy, extack); | 1298 | nldev_policy, extack); |
1299 | if (err || !tb[RDMA_NLDEV_ATTR_DEV_INDEX]) | 1299 | if (err || !tb[RDMA_NLDEV_ATTR_DEV_INDEX]) |
1300 | return -EINVAL; | 1300 | return -EINVAL; |
1301 | 1301 | ||
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index 7925e45ea88a..bb534959abf0 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c | |||
@@ -1028,8 +1028,8 @@ int ib_nl_handle_set_timeout(struct sk_buff *skb, | |||
1028 | !(NETLINK_CB(skb).sk)) | 1028 | !(NETLINK_CB(skb).sk)) |
1029 | return -EPERM; | 1029 | return -EPERM; |
1030 | 1030 | ||
1031 | ret = nla_parse(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh), | 1031 | ret = nla_parse_deprecated(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh), |
1032 | nlmsg_len(nlh), ib_nl_policy, NULL); | 1032 | nlmsg_len(nlh), ib_nl_policy, NULL); |
1033 | attr = (const struct nlattr *)tb[LS_NLA_TYPE_TIMEOUT]; | 1033 | attr = (const struct nlattr *)tb[LS_NLA_TYPE_TIMEOUT]; |
1034 | if (ret || !attr) | 1034 | if (ret || !attr) |
1035 | goto settimeout_out; | 1035 | goto settimeout_out; |
@@ -1080,8 +1080,8 @@ static inline int ib_nl_is_good_resolve_resp(const struct nlmsghdr *nlh) | |||
1080 | if (nlh->nlmsg_flags & RDMA_NL_LS_F_ERR) | 1080 | if (nlh->nlmsg_flags & RDMA_NL_LS_F_ERR) |
1081 | return 0; | 1081 | return 0; |
1082 | 1082 | ||
1083 | ret = nla_parse(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh), | 1083 | ret = nla_parse_deprecated(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh), |
1084 | nlmsg_len(nlh), ib_nl_policy, NULL); | 1084 | nlmsg_len(nlh), ib_nl_policy, NULL); |
1085 | if (ret) | 1085 | if (ret) |
1086 | return 0; | 1086 | return 0; |
1087 | 1087 | ||
diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c index 80ca300aba04..486a3a3bf35b 100644 --- a/drivers/net/ieee802154/mac802154_hwsim.c +++ b/drivers/net/ieee802154/mac802154_hwsim.c | |||
@@ -430,9 +430,7 @@ static int hwsim_new_edge_nl(struct sk_buff *msg, struct genl_info *info) | |||
430 | !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE]) | 430 | !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE]) |
431 | return -EINVAL; | 431 | return -EINVAL; |
432 | 432 | ||
433 | if (nla_parse_nested(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX, | 433 | if (nla_parse_nested_deprecated(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX, info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE], hwsim_edge_policy, NULL)) |
434 | info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE], | ||
435 | hwsim_edge_policy, NULL)) | ||
436 | return -EINVAL; | 434 | return -EINVAL; |
437 | 435 | ||
438 | if (!edge_attrs[MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID]) | 436 | if (!edge_attrs[MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID]) |
@@ -494,9 +492,7 @@ static int hwsim_del_edge_nl(struct sk_buff *msg, struct genl_info *info) | |||
494 | !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE]) | 492 | !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE]) |
495 | return -EINVAL; | 493 | return -EINVAL; |
496 | 494 | ||
497 | if (nla_parse_nested(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX, | 495 | if (nla_parse_nested_deprecated(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX, info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE], hwsim_edge_policy, NULL)) |
498 | info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE], | ||
499 | hwsim_edge_policy, NULL)) | ||
500 | return -EINVAL; | 496 | return -EINVAL; |
501 | 497 | ||
502 | if (!edge_attrs[MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID]) | 498 | if (!edge_attrs[MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID]) |
@@ -544,9 +540,7 @@ static int hwsim_set_edge_lqi(struct sk_buff *msg, struct genl_info *info) | |||
544 | !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE]) | 540 | !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE]) |
545 | return -EINVAL; | 541 | return -EINVAL; |
546 | 542 | ||
547 | if (nla_parse_nested(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX, | 543 | if (nla_parse_nested_deprecated(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX, info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE], hwsim_edge_policy, NULL)) |
548 | info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE], | ||
549 | hwsim_edge_policy, NULL)) | ||
550 | return -EINVAL; | 544 | return -EINVAL; |
551 | 545 | ||
552 | if (!edge_attrs[MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID] && | 546 | if (!edge_attrs[MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID] && |
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 8dedb9a9781e..c3fa3d8da8f3 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c | |||
@@ -1611,9 +1611,7 @@ static int parse_sa_config(struct nlattr **attrs, struct nlattr **tb_sa) | |||
1611 | if (!attrs[MACSEC_ATTR_SA_CONFIG]) | 1611 | if (!attrs[MACSEC_ATTR_SA_CONFIG]) |
1612 | return -EINVAL; | 1612 | return -EINVAL; |
1613 | 1613 | ||
1614 | if (nla_parse_nested(tb_sa, MACSEC_SA_ATTR_MAX, | 1614 | if (nla_parse_nested_deprecated(tb_sa, MACSEC_SA_ATTR_MAX, attrs[MACSEC_ATTR_SA_CONFIG], macsec_genl_sa_policy, NULL)) |
1615 | attrs[MACSEC_ATTR_SA_CONFIG], | ||
1616 | macsec_genl_sa_policy, NULL)) | ||
1617 | return -EINVAL; | 1615 | return -EINVAL; |
1618 | 1616 | ||
1619 | return 0; | 1617 | return 0; |
@@ -1624,9 +1622,7 @@ static int parse_rxsc_config(struct nlattr **attrs, struct nlattr **tb_rxsc) | |||
1624 | if (!attrs[MACSEC_ATTR_RXSC_CONFIG]) | 1622 | if (!attrs[MACSEC_ATTR_RXSC_CONFIG]) |
1625 | return -EINVAL; | 1623 | return -EINVAL; |
1626 | 1624 | ||
1627 | if (nla_parse_nested(tb_rxsc, MACSEC_RXSC_ATTR_MAX, | 1625 | if (nla_parse_nested_deprecated(tb_rxsc, MACSEC_RXSC_ATTR_MAX, attrs[MACSEC_ATTR_RXSC_CONFIG], macsec_genl_rxsc_policy, NULL)) |
1628 | attrs[MACSEC_ATTR_RXSC_CONFIG], | ||
1629 | macsec_genl_rxsc_policy, NULL)) | ||
1630 | return -EINVAL; | 1626 | return -EINVAL; |
1631 | 1627 | ||
1632 | return 0; | 1628 | return 0; |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 6306897c147f..be58445afbbc 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
@@ -2510,9 +2510,11 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) | |||
2510 | err = -EINVAL; | 2510 | err = -EINVAL; |
2511 | goto team_put; | 2511 | goto team_put; |
2512 | } | 2512 | } |
2513 | err = nla_parse_nested(opt_attrs, TEAM_ATTR_OPTION_MAX, | 2513 | err = nla_parse_nested_deprecated(opt_attrs, |
2514 | nl_option, team_nl_option_policy, | 2514 | TEAM_ATTR_OPTION_MAX, |
2515 | info->extack); | 2515 | nl_option, |
2516 | team_nl_option_policy, | ||
2517 | info->extack); | ||
2516 | if (err) | 2518 | if (err) |
2517 | goto team_put; | 2519 | goto team_put; |
2518 | if (!opt_attrs[TEAM_ATTR_OPTION_NAME] || | 2520 | if (!opt_attrs[TEAM_ATTR_OPTION_NAME] || |
diff --git a/drivers/net/wireless/ath/ath10k/testmode.c b/drivers/net/wireless/ath/ath10k/testmode.c index 6433ff10d80e..a29cfb9c72c2 100644 --- a/drivers/net/wireless/ath/ath10k/testmode.c +++ b/drivers/net/wireless/ath/ath10k/testmode.c | |||
@@ -416,8 +416,8 @@ int ath10k_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
416 | struct nlattr *tb[ATH10K_TM_ATTR_MAX + 1]; | 416 | struct nlattr *tb[ATH10K_TM_ATTR_MAX + 1]; |
417 | int ret; | 417 | int ret; |
418 | 418 | ||
419 | ret = nla_parse(tb, ATH10K_TM_ATTR_MAX, data, len, ath10k_tm_policy, | 419 | ret = nla_parse_deprecated(tb, ATH10K_TM_ATTR_MAX, data, len, |
420 | NULL); | 420 | ath10k_tm_policy, NULL); |
421 | if (ret) | 421 | if (ret) |
422 | return ret; | 422 | return ret; |
423 | 423 | ||
diff --git a/drivers/net/wireless/ath/ath6kl/testmode.c b/drivers/net/wireless/ath/ath6kl/testmode.c index d8dcacda9add..f3906dbe5495 100644 --- a/drivers/net/wireless/ath/ath6kl/testmode.c +++ b/drivers/net/wireless/ath/ath6kl/testmode.c | |||
@@ -74,8 +74,8 @@ int ath6kl_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev, | |||
74 | int err, buf_len; | 74 | int err, buf_len; |
75 | void *buf; | 75 | void *buf; |
76 | 76 | ||
77 | err = nla_parse(tb, ATH6KL_TM_ATTR_MAX, data, len, ath6kl_tm_policy, | 77 | err = nla_parse_deprecated(tb, ATH6KL_TM_ATTR_MAX, data, len, |
78 | NULL); | 78 | ath6kl_tm_policy, NULL); |
79 | if (err) | 79 | if (err) |
80 | return err; | 80 | return err; |
81 | 81 | ||
diff --git a/drivers/net/wireless/ath/wcn36xx/testmode.c b/drivers/net/wireless/ath/wcn36xx/testmode.c index 51a038022c8b..7ae14b4d2d0e 100644 --- a/drivers/net/wireless/ath/wcn36xx/testmode.c +++ b/drivers/net/wireless/ath/wcn36xx/testmode.c | |||
@@ -132,8 +132,8 @@ int wcn36xx_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
132 | unsigned short attr; | 132 | unsigned short attr; |
133 | 133 | ||
134 | wcn36xx_dbg_dump(WCN36XX_DBG_TESTMODE_DUMP, "Data:", data, len); | 134 | wcn36xx_dbg_dump(WCN36XX_DBG_TESTMODE_DUMP, "Data:", data, len); |
135 | ret = nla_parse(tb, WCN36XX_TM_ATTR_MAX, data, len, | 135 | ret = nla_parse_deprecated(tb, WCN36XX_TM_ATTR_MAX, data, len, |
136 | wcn36xx_tm_policy, NULL); | 136 | wcn36xx_tm_policy, NULL); |
137 | if (ret) | 137 | if (ret) |
138 | return ret; | 138 | return ret; |
139 | 139 | ||
diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c index cac18e61474e..9a67ad2a589c 100644 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c | |||
@@ -2620,8 +2620,8 @@ static int wil_rf_sector_get_cfg(struct wiphy *wiphy, | |||
2620 | if (!test_bit(WMI_FW_CAPABILITY_RF_SECTORS, wil->fw_capabilities)) | 2620 | if (!test_bit(WMI_FW_CAPABILITY_RF_SECTORS, wil->fw_capabilities)) |
2621 | return -EOPNOTSUPP; | 2621 | return -EOPNOTSUPP; |
2622 | 2622 | ||
2623 | rc = nla_parse(tb, QCA_ATTR_DMG_RF_SECTOR_MAX, data, data_len, | 2623 | rc = nla_parse_deprecated(tb, QCA_ATTR_DMG_RF_SECTOR_MAX, data, |
2624 | wil_rf_sector_policy, NULL); | 2624 | data_len, wil_rf_sector_policy, NULL); |
2625 | if (rc) { | 2625 | if (rc) { |
2626 | wil_err(wil, "Invalid rf sector ATTR\n"); | 2626 | wil_err(wil, "Invalid rf sector ATTR\n"); |
2627 | return rc; | 2627 | return rc; |
@@ -2740,8 +2740,8 @@ static int wil_rf_sector_set_cfg(struct wiphy *wiphy, | |||
2740 | if (!test_bit(WMI_FW_CAPABILITY_RF_SECTORS, wil->fw_capabilities)) | 2740 | if (!test_bit(WMI_FW_CAPABILITY_RF_SECTORS, wil->fw_capabilities)) |
2741 | return -EOPNOTSUPP; | 2741 | return -EOPNOTSUPP; |
2742 | 2742 | ||
2743 | rc = nla_parse(tb, QCA_ATTR_DMG_RF_SECTOR_MAX, data, data_len, | 2743 | rc = nla_parse_deprecated(tb, QCA_ATTR_DMG_RF_SECTOR_MAX, data, |
2744 | wil_rf_sector_policy, NULL); | 2744 | data_len, wil_rf_sector_policy, NULL); |
2745 | if (rc) { | 2745 | if (rc) { |
2746 | wil_err(wil, "Invalid rf sector ATTR\n"); | 2746 | wil_err(wil, "Invalid rf sector ATTR\n"); |
2747 | return rc; | 2747 | return rc; |
@@ -2773,9 +2773,11 @@ static int wil_rf_sector_set_cfg(struct wiphy *wiphy, | |||
2773 | cmd.sector_type = sector_type; | 2773 | cmd.sector_type = sector_type; |
2774 | nla_for_each_nested(nl_cfg, tb[QCA_ATTR_DMG_RF_SECTOR_CFG], | 2774 | nla_for_each_nested(nl_cfg, tb[QCA_ATTR_DMG_RF_SECTOR_CFG], |
2775 | tmp) { | 2775 | tmp) { |
2776 | rc = nla_parse_nested(tb2, QCA_ATTR_DMG_RF_SECTOR_CFG_MAX, | 2776 | rc = nla_parse_nested_deprecated(tb2, |
2777 | nl_cfg, wil_rf_sector_cfg_policy, | 2777 | QCA_ATTR_DMG_RF_SECTOR_CFG_MAX, |
2778 | NULL); | 2778 | nl_cfg, |
2779 | wil_rf_sector_cfg_policy, | ||
2780 | NULL); | ||
2779 | if (rc) { | 2781 | if (rc) { |
2780 | wil_err(wil, "invalid sector cfg\n"); | 2782 | wil_err(wil, "invalid sector cfg\n"); |
2781 | return -EINVAL; | 2783 | return -EINVAL; |
@@ -2847,8 +2849,8 @@ static int wil_rf_sector_get_selected(struct wiphy *wiphy, | |||
2847 | if (!test_bit(WMI_FW_CAPABILITY_RF_SECTORS, wil->fw_capabilities)) | 2849 | if (!test_bit(WMI_FW_CAPABILITY_RF_SECTORS, wil->fw_capabilities)) |
2848 | return -EOPNOTSUPP; | 2850 | return -EOPNOTSUPP; |
2849 | 2851 | ||
2850 | rc = nla_parse(tb, QCA_ATTR_DMG_RF_SECTOR_MAX, data, data_len, | 2852 | rc = nla_parse_deprecated(tb, QCA_ATTR_DMG_RF_SECTOR_MAX, data, |
2851 | wil_rf_sector_policy, NULL); | 2853 | data_len, wil_rf_sector_policy, NULL); |
2852 | if (rc) { | 2854 | if (rc) { |
2853 | wil_err(wil, "Invalid rf sector ATTR\n"); | 2855 | wil_err(wil, "Invalid rf sector ATTR\n"); |
2854 | return rc; | 2856 | return rc; |
@@ -2955,8 +2957,8 @@ static int wil_rf_sector_set_selected(struct wiphy *wiphy, | |||
2955 | if (!test_bit(WMI_FW_CAPABILITY_RF_SECTORS, wil->fw_capabilities)) | 2957 | if (!test_bit(WMI_FW_CAPABILITY_RF_SECTORS, wil->fw_capabilities)) |
2956 | return -EOPNOTSUPP; | 2958 | return -EOPNOTSUPP; |
2957 | 2959 | ||
2958 | rc = nla_parse(tb, QCA_ATTR_DMG_RF_SECTOR_MAX, data, data_len, | 2960 | rc = nla_parse_deprecated(tb, QCA_ATTR_DMG_RF_SECTOR_MAX, data, |
2959 | wil_rf_sector_policy, NULL); | 2961 | data_len, wil_rf_sector_policy, NULL); |
2960 | if (rc) { | 2962 | if (rc) { |
2961 | wil_err(wil, "Invalid rf sector ATTR\n"); | 2963 | wil_err(wil, "Invalid rf sector ATTR\n"); |
2962 | return rc; | 2964 | return rc; |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index d4c7f08f08e3..5c52469288be 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | |||
@@ -4465,8 +4465,8 @@ static int __iwl_mvm_mac_testmode_cmd(struct iwl_mvm *mvm, | |||
4465 | int err; | 4465 | int err; |
4466 | u32 noa_duration; | 4466 | u32 noa_duration; |
4467 | 4467 | ||
4468 | err = nla_parse(tb, IWL_MVM_TM_ATTR_MAX, data, len, iwl_mvm_tm_policy, | 4468 | err = nla_parse_deprecated(tb, IWL_MVM_TM_ATTR_MAX, data, len, |
4469 | NULL); | 4469 | iwl_mvm_tm_policy, NULL); |
4470 | if (err) | 4470 | if (err) |
4471 | return err; | 4471 | return err; |
4472 | 4472 | ||
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 4c2145ba87a0..2a1aa2f6e7dc 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -409,8 +409,8 @@ static int mac80211_hwsim_vendor_cmd_test(struct wiphy *wiphy, | |||
409 | int err; | 409 | int err; |
410 | u32 val; | 410 | u32 val; |
411 | 411 | ||
412 | err = nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, data, data_len, | 412 | err = nla_parse_deprecated(tb, QCA_WLAN_VENDOR_ATTR_MAX, data, |
413 | hwsim_vendor_test_policy, NULL); | 413 | data_len, hwsim_vendor_test_policy, NULL); |
414 | if (err) | 414 | if (err) |
415 | return err; | 415 | return err; |
416 | if (!tb[QCA_WLAN_VENDOR_ATTR_TEST]) | 416 | if (!tb[QCA_WLAN_VENDOR_ATTR_TEST]) |
@@ -1936,8 +1936,8 @@ static int mac80211_hwsim_testmode_cmd(struct ieee80211_hw *hw, | |||
1936 | struct sk_buff *skb; | 1936 | struct sk_buff *skb; |
1937 | int err, ps; | 1937 | int err, ps; |
1938 | 1938 | ||
1939 | err = nla_parse(tb, HWSIM_TM_ATTR_MAX, data, len, | 1939 | err = nla_parse_deprecated(tb, HWSIM_TM_ATTR_MAX, data, len, |
1940 | hwsim_testmode_policy, NULL); | 1940 | hwsim_testmode_policy, NULL); |
1941 | if (err) | 1941 | if (err) |
1942 | return err; | 1942 | return err; |
1943 | 1943 | ||
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index e582d9b3e50c..e11a4bb67172 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c | |||
@@ -4059,8 +4059,8 @@ static int mwifiex_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev, | |||
4059 | if (!priv) | 4059 | if (!priv) |
4060 | return -EINVAL; | 4060 | return -EINVAL; |
4061 | 4061 | ||
4062 | err = nla_parse(tb, MWIFIEX_TM_ATTR_MAX, data, len, mwifiex_tm_policy, | 4062 | err = nla_parse_deprecated(tb, MWIFIEX_TM_ATTR_MAX, data, len, |
4063 | NULL); | 4063 | mwifiex_tm_policy, NULL); |
4064 | if (err) | 4064 | if (err) |
4065 | return err; | 4065 | return err; |
4066 | 4066 | ||
diff --git a/drivers/net/wireless/ti/wlcore/testmode.c b/drivers/net/wireless/ti/wlcore/testmode.c index dcb2c8b0feb6..affefaaea1ea 100644 --- a/drivers/net/wireless/ti/wlcore/testmode.c +++ b/drivers/net/wireless/ti/wlcore/testmode.c | |||
@@ -372,8 +372,8 @@ int wl1271_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
372 | u32 nla_cmd; | 372 | u32 nla_cmd; |
373 | int err; | 373 | int err; |
374 | 374 | ||
375 | err = nla_parse(tb, WL1271_TM_ATTR_MAX, data, len, wl1271_tm_policy, | 375 | err = nla_parse_deprecated(tb, WL1271_TM_ATTR_MAX, data, len, |
376 | NULL); | 376 | wl1271_tm_policy, NULL); |
377 | if (err) | 377 | if (err) |
378 | return err; | 378 | return err; |
379 | 379 | ||
diff --git a/drivers/net/wireless/ti/wlcore/vendor_cmd.c b/drivers/net/wireless/ti/wlcore/vendor_cmd.c index 7f34ec077ee5..75756fb8e7b0 100644 --- a/drivers/net/wireless/ti/wlcore/vendor_cmd.c +++ b/drivers/net/wireless/ti/wlcore/vendor_cmd.c | |||
@@ -41,8 +41,8 @@ wlcore_vendor_cmd_smart_config_start(struct wiphy *wiphy, | |||
41 | if (!data) | 41 | if (!data) |
42 | return -EINVAL; | 42 | return -EINVAL; |
43 | 43 | ||
44 | ret = nla_parse(tb, MAX_WLCORE_VENDOR_ATTR, data, data_len, | 44 | ret = nla_parse_deprecated(tb, MAX_WLCORE_VENDOR_ATTR, data, data_len, |
45 | wlcore_vendor_attr_policy, NULL); | 45 | wlcore_vendor_attr_policy, NULL); |
46 | if (ret) | 46 | if (ret) |
47 | return ret; | 47 | return ret; |
48 | 48 | ||
@@ -122,8 +122,8 @@ wlcore_vendor_cmd_smart_config_set_group_key(struct wiphy *wiphy, | |||
122 | if (!data) | 122 | if (!data) |
123 | return -EINVAL; | 123 | return -EINVAL; |
124 | 124 | ||
125 | ret = nla_parse(tb, MAX_WLCORE_VENDOR_ATTR, data, data_len, | 125 | ret = nla_parse_deprecated(tb, MAX_WLCORE_VENDOR_ATTR, data, data_len, |
126 | wlcore_vendor_attr_policy, NULL); | 126 | wlcore_vendor_attr_policy, NULL); |
127 | if (ret) | 127 | if (ret) |
128 | return ret; | 128 | return ret; |
129 | 129 | ||
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 6850c7b1a3a6..897cdba13569 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
@@ -165,7 +165,7 @@ static inline struct nlmsghdr *genlmsg_nlhdr(void *user_hdr) | |||
165 | } | 165 | } |
166 | 166 | ||
167 | /** | 167 | /** |
168 | * genlmsg_parse - parse attributes of a genetlink message | 168 | * genlmsg_parse_deprecated - parse attributes of a genetlink message |
169 | * @nlh: netlink message header | 169 | * @nlh: netlink message header |
170 | * @family: genetlink message family | 170 | * @family: genetlink message family |
171 | * @tb: destination array with maxtype+1 elements | 171 | * @tb: destination array with maxtype+1 elements |
@@ -173,14 +173,14 @@ static inline struct nlmsghdr *genlmsg_nlhdr(void *user_hdr) | |||
173 | * @policy: validation policy | 173 | * @policy: validation policy |
174 | * @extack: extended ACK report struct | 174 | * @extack: extended ACK report struct |
175 | */ | 175 | */ |
176 | static inline int genlmsg_parse(const struct nlmsghdr *nlh, | 176 | static inline int genlmsg_parse_deprecated(const struct nlmsghdr *nlh, |
177 | const struct genl_family *family, | 177 | const struct genl_family *family, |
178 | struct nlattr *tb[], int maxtype, | 178 | struct nlattr *tb[], int maxtype, |
179 | const struct nla_policy *policy, | 179 | const struct nla_policy *policy, |
180 | struct netlink_ext_ack *extack) | 180 | struct netlink_ext_ack *extack) |
181 | { | 181 | { |
182 | return nlmsg_parse(nlh, family->hdrsize + GENL_HDRLEN, tb, maxtype, | 182 | return __nlmsg_parse(nlh, family->hdrsize + GENL_HDRLEN, tb, maxtype, |
183 | policy, extack); | 183 | policy, NL_VALIDATE_LIBERAL, extack); |
184 | } | 184 | } |
185 | 185 | ||
186 | /** | 186 | /** |
diff --git a/include/net/netlink.h b/include/net/netlink.h index c77ed51c18f1..ab26a5e3558b 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -369,21 +369,48 @@ struct nl_info { | |||
369 | bool skip_notify; | 369 | bool skip_notify; |
370 | }; | 370 | }; |
371 | 371 | ||
372 | /** | ||
373 | * enum netlink_validation - netlink message/attribute validation levels | ||
374 | * @NL_VALIDATE_LIBERAL: Old-style "be liberal" validation, not caring about | ||
375 | * extra data at the end of the message, attributes being longer than | ||
376 | * they should be, or unknown attributes being present. | ||
377 | * @NL_VALIDATE_TRAILING: Reject junk data encountered after attribute parsing. | ||
378 | * @NL_VALIDATE_MAXTYPE: Reject attributes > max type; Together with _TRAILING | ||
379 | * this is equivalent to the old nla_parse_strict()/nlmsg_parse_strict(). | ||
380 | * @NL_VALIDATE_UNSPEC: Reject attributes with NLA_UNSPEC in the policy. | ||
381 | * This can safely be set by the kernel when the given policy has no | ||
382 | * NLA_UNSPEC anymore, and can thus be used to ensure policy entries | ||
383 | * are enforced going forward. | ||
384 | * @NL_VALIDATE_STRICT_ATTRS: strict attribute policy parsing (e.g. | ||
385 | * U8, U16, U32 must have exact size, etc.) | ||
386 | */ | ||
387 | enum netlink_validation { | ||
388 | NL_VALIDATE_LIBERAL = 0, | ||
389 | NL_VALIDATE_TRAILING = BIT(0), | ||
390 | NL_VALIDATE_MAXTYPE = BIT(1), | ||
391 | NL_VALIDATE_UNSPEC = BIT(2), | ||
392 | NL_VALIDATE_STRICT_ATTRS = BIT(3), | ||
393 | }; | ||
394 | |||
395 | #define NL_VALIDATE_DEPRECATED_STRICT (NL_VALIDATE_TRAILING |\ | ||
396 | NL_VALIDATE_MAXTYPE) | ||
397 | #define NL_VALIDATE_STRICT (NL_VALIDATE_TRAILING |\ | ||
398 | NL_VALIDATE_MAXTYPE |\ | ||
399 | NL_VALIDATE_UNSPEC |\ | ||
400 | NL_VALIDATE_STRICT_ATTRS) | ||
401 | |||
372 | int netlink_rcv_skb(struct sk_buff *skb, | 402 | int netlink_rcv_skb(struct sk_buff *skb, |
373 | int (*cb)(struct sk_buff *, struct nlmsghdr *, | 403 | int (*cb)(struct sk_buff *, struct nlmsghdr *, |
374 | struct netlink_ext_ack *)); | 404 | struct netlink_ext_ack *)); |
375 | int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 portid, | 405 | int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 portid, |
376 | unsigned int group, int report, gfp_t flags); | 406 | unsigned int group, int report, gfp_t flags); |
377 | 407 | ||
378 | int nla_validate(const struct nlattr *head, int len, int maxtype, | 408 | int __nla_validate(const struct nlattr *head, int len, int maxtype, |
379 | const struct nla_policy *policy, | 409 | const struct nla_policy *policy, unsigned int validate, |
380 | struct netlink_ext_ack *extack); | 410 | struct netlink_ext_ack *extack); |
381 | int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head, | 411 | int __nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head, |
382 | int len, const struct nla_policy *policy, | 412 | int len, const struct nla_policy *policy, unsigned int validate, |
383 | struct netlink_ext_ack *extack); | 413 | struct netlink_ext_ack *extack); |
384 | int nla_parse_strict(struct nlattr **tb, int maxtype, const struct nlattr *head, | ||
385 | int len, const struct nla_policy *policy, | ||
386 | struct netlink_ext_ack *extack); | ||
387 | int nla_policy_len(const struct nla_policy *, int); | 414 | int nla_policy_len(const struct nla_policy *, int); |
388 | struct nlattr *nla_find(const struct nlattr *head, int len, int attrtype); | 415 | struct nlattr *nla_find(const struct nlattr *head, int len, int attrtype); |
389 | size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize); | 416 | size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize); |
@@ -512,42 +539,121 @@ nlmsg_next(const struct nlmsghdr *nlh, int *remaining) | |||
512 | } | 539 | } |
513 | 540 | ||
514 | /** | 541 | /** |
515 | * nlmsg_parse - parse attributes of a netlink message | 542 | * nla_parse_deprecated - Parse a stream of attributes into a tb buffer |
543 | * @tb: destination array with maxtype+1 elements | ||
544 | * @maxtype: maximum attribute type to be expected | ||
545 | * @head: head of attribute stream | ||
546 | * @len: length of attribute stream | ||
547 | * @policy: validation policy | ||
548 | * @extack: extended ACK pointer | ||
549 | * | ||
550 | * Parses a stream of attributes and stores a pointer to each attribute in | ||
551 | * the tb array accessible via the attribute type. Attributes with a type | ||
552 | * exceeding maxtype will be ignored and attributes from the policy are not | ||
553 | * always strictly validated (only for new attributes). | ||
554 | * | ||
555 | * Returns 0 on success or a negative error code. | ||
556 | */ | ||
557 | static inline int nla_parse_deprecated(struct nlattr **tb, int maxtype, | ||
558 | const struct nlattr *head, int len, | ||
559 | const struct nla_policy *policy, | ||
560 | struct netlink_ext_ack *extack) | ||
561 | { | ||
562 | return __nla_parse(tb, maxtype, head, len, policy, | ||
563 | NL_VALIDATE_LIBERAL, extack); | ||
564 | } | ||
565 | |||
566 | /** | ||
567 | * nla_parse_deprecated_strict - Parse a stream of attributes into a tb buffer | ||
568 | * @tb: destination array with maxtype+1 elements | ||
569 | * @maxtype: maximum attribute type to be expected | ||
570 | * @head: head of attribute stream | ||
571 | * @len: length of attribute stream | ||
572 | * @policy: validation policy | ||
573 | * @extack: extended ACK pointer | ||
574 | * | ||
575 | * Parses a stream of attributes and stores a pointer to each attribute in | ||
576 | * the tb array accessible via the attribute type. Attributes with a type | ||
577 | * exceeding maxtype will be rejected as well as trailing data, but the | ||
578 | * policy is not completely strictly validated (only for new attributes). | ||
579 | * | ||
580 | * Returns 0 on success or a negative error code. | ||
581 | */ | ||
582 | static inline int nla_parse_deprecated_strict(struct nlattr **tb, int maxtype, | ||
583 | const struct nlattr *head, | ||
584 | int len, | ||
585 | const struct nla_policy *policy, | ||
586 | struct netlink_ext_ack *extack) | ||
587 | { | ||
588 | return __nla_parse(tb, maxtype, head, len, policy, | ||
589 | NL_VALIDATE_DEPRECATED_STRICT, extack); | ||
590 | } | ||
591 | |||
592 | /** | ||
593 | * __nlmsg_parse - parse attributes of a netlink message | ||
516 | * @nlh: netlink message header | 594 | * @nlh: netlink message header |
517 | * @hdrlen: length of family specific header | 595 | * @hdrlen: length of family specific header |
518 | * @tb: destination array with maxtype+1 elements | 596 | * @tb: destination array with maxtype+1 elements |
519 | * @maxtype: maximum attribute type to be expected | 597 | * @maxtype: maximum attribute type to be expected |
520 | * @policy: validation policy | 598 | * @policy: validation policy |
599 | * @validate: validation strictness | ||
521 | * @extack: extended ACK report struct | 600 | * @extack: extended ACK report struct |
522 | * | 601 | * |
523 | * See nla_parse() | 602 | * See nla_parse() |
524 | */ | 603 | */ |
525 | static inline int nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen, | 604 | static inline int __nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen, |
526 | struct nlattr *tb[], int maxtype, | 605 | struct nlattr *tb[], int maxtype, |
527 | const struct nla_policy *policy, | 606 | const struct nla_policy *policy, |
528 | struct netlink_ext_ack *extack) | 607 | unsigned int validate, |
608 | struct netlink_ext_ack *extack) | ||
529 | { | 609 | { |
530 | if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) { | 610 | if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) { |
531 | NL_SET_ERR_MSG(extack, "Invalid header length"); | 611 | NL_SET_ERR_MSG(extack, "Invalid header length"); |
532 | return -EINVAL; | 612 | return -EINVAL; |
533 | } | 613 | } |
534 | 614 | ||
535 | return nla_parse(tb, maxtype, nlmsg_attrdata(nlh, hdrlen), | 615 | return __nla_parse(tb, maxtype, nlmsg_attrdata(nlh, hdrlen), |
536 | nlmsg_attrlen(nlh, hdrlen), policy, extack); | 616 | nlmsg_attrlen(nlh, hdrlen), policy, validate, |
617 | extack); | ||
537 | } | 618 | } |
538 | 619 | ||
539 | static inline int nlmsg_parse_strict(const struct nlmsghdr *nlh, int hdrlen, | 620 | /** |
540 | struct nlattr *tb[], int maxtype, | 621 | * nlmsg_parse_deprecated - parse attributes of a netlink message |
541 | const struct nla_policy *policy, | 622 | * @nlh: netlink message header |
542 | struct netlink_ext_ack *extack) | 623 | * @hdrlen: length of family specific header |
624 | * @tb: destination array with maxtype+1 elements | ||
625 | * @maxtype: maximum attribute type to be expected | ||
626 | * @extack: extended ACK report struct | ||
627 | * | ||
628 | * See nla_parse_deprecated() | ||
629 | */ | ||
630 | static inline int nlmsg_parse_deprecated(const struct nlmsghdr *nlh, int hdrlen, | ||
631 | struct nlattr *tb[], int maxtype, | ||
632 | const struct nla_policy *policy, | ||
633 | struct netlink_ext_ack *extack) | ||
543 | { | 634 | { |
544 | if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) { | 635 | return __nlmsg_parse(nlh, hdrlen, tb, maxtype, policy, |
545 | NL_SET_ERR_MSG(extack, "Invalid header length"); | 636 | NL_VALIDATE_LIBERAL, extack); |
546 | return -EINVAL; | 637 | } |
547 | } | ||
548 | 638 | ||
549 | return nla_parse_strict(tb, maxtype, nlmsg_attrdata(nlh, hdrlen), | 639 | /** |
550 | nlmsg_attrlen(nlh, hdrlen), policy, extack); | 640 | * nlmsg_parse_deprecated_strict - parse attributes of a netlink message |
641 | * @nlh: netlink message header | ||
642 | * @hdrlen: length of family specific header | ||
643 | * @tb: destination array with maxtype+1 elements | ||
644 | * @maxtype: maximum attribute type to be expected | ||
645 | * @extack: extended ACK report struct | ||
646 | * | ||
647 | * See nla_parse_deprecated_strict() | ||
648 | */ | ||
649 | static inline int | ||
650 | nlmsg_parse_deprecated_strict(const struct nlmsghdr *nlh, int hdrlen, | ||
651 | struct nlattr *tb[], int maxtype, | ||
652 | const struct nla_policy *policy, | ||
653 | struct netlink_ext_ack *extack) | ||
654 | { | ||
655 | return __nlmsg_parse(nlh, hdrlen, tb, maxtype, policy, | ||
656 | NL_VALIDATE_DEPRECATED_STRICT, extack); | ||
551 | } | 657 | } |
552 | 658 | ||
553 | /** | 659 | /** |
@@ -566,26 +672,53 @@ static inline struct nlattr *nlmsg_find_attr(const struct nlmsghdr *nlh, | |||
566 | } | 672 | } |
567 | 673 | ||
568 | /** | 674 | /** |
569 | * nlmsg_validate - validate a netlink message including attributes | 675 | * nla_validate_deprecated - Validate a stream of attributes |
676 | * @head: head of attribute stream | ||
677 | * @len: length of attribute stream | ||
678 | * @maxtype: maximum attribute type to be expected | ||
679 | * @policy: validation policy | ||
680 | * @validate: validation strictness | ||
681 | * @extack: extended ACK report struct | ||
682 | * | ||
683 | * Validates all attributes in the specified attribute stream against the | ||
684 | * specified policy. Validation is done in liberal mode. | ||
685 | * See documenation of struct nla_policy for more details. | ||
686 | * | ||
687 | * Returns 0 on success or a negative error code. | ||
688 | */ | ||
689 | static inline int nla_validate_deprecated(const struct nlattr *head, int len, | ||
690 | int maxtype, | ||
691 | const struct nla_policy *policy, | ||
692 | struct netlink_ext_ack *extack) | ||
693 | { | ||
694 | return __nla_validate(head, len, maxtype, policy, NL_VALIDATE_LIBERAL, | ||
695 | extack); | ||
696 | } | ||
697 | |||
698 | |||
699 | /** | ||
700 | * nlmsg_validate_deprecated - validate a netlink message including attributes | ||
570 | * @nlh: netlinket message header | 701 | * @nlh: netlinket message header |
571 | * @hdrlen: length of familiy specific header | 702 | * @hdrlen: length of familiy specific header |
572 | * @maxtype: maximum attribute type to be expected | 703 | * @maxtype: maximum attribute type to be expected |
573 | * @policy: validation policy | 704 | * @policy: validation policy |
574 | * @extack: extended ACK report struct | 705 | * @extack: extended ACK report struct |
575 | */ | 706 | */ |
576 | static inline int nlmsg_validate(const struct nlmsghdr *nlh, | 707 | static inline int nlmsg_validate_deprecated(const struct nlmsghdr *nlh, |
577 | int hdrlen, int maxtype, | 708 | int hdrlen, int maxtype, |
578 | const struct nla_policy *policy, | 709 | const struct nla_policy *policy, |
579 | struct netlink_ext_ack *extack) | 710 | struct netlink_ext_ack *extack) |
580 | { | 711 | { |
581 | if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) | 712 | if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) |
582 | return -EINVAL; | 713 | return -EINVAL; |
583 | 714 | ||
584 | return nla_validate(nlmsg_attrdata(nlh, hdrlen), | 715 | return __nla_validate(nlmsg_attrdata(nlh, hdrlen), |
585 | nlmsg_attrlen(nlh, hdrlen), maxtype, policy, | 716 | nlmsg_attrlen(nlh, hdrlen), maxtype, |
586 | extack); | 717 | policy, NL_VALIDATE_LIBERAL, extack); |
587 | } | 718 | } |
588 | 719 | ||
720 | |||
721 | |||
589 | /** | 722 | /** |
590 | * nlmsg_report - need to report back to application? | 723 | * nlmsg_report - need to report back to application? |
591 | * @nlh: netlink message header | 724 | * @nlh: netlink message header |
@@ -899,22 +1032,22 @@ nla_find_nested(const struct nlattr *nla, int attrtype) | |||
899 | } | 1032 | } |
900 | 1033 | ||
901 | /** | 1034 | /** |
902 | * nla_parse_nested - parse nested attributes | 1035 | * nla_parse_nested_deprecated - parse nested attributes |
903 | * @tb: destination array with maxtype+1 elements | 1036 | * @tb: destination array with maxtype+1 elements |
904 | * @maxtype: maximum attribute type to be expected | 1037 | * @maxtype: maximum attribute type to be expected |
905 | * @nla: attribute containing the nested attributes | 1038 | * @nla: attribute containing the nested attributes |
906 | * @policy: validation policy | 1039 | * @policy: validation policy |
907 | * @extack: extended ACK report struct | 1040 | * @extack: extended ACK report struct |
908 | * | 1041 | * |
909 | * See nla_parse() | 1042 | * See nla_parse_deprecated() |
910 | */ | 1043 | */ |
911 | static inline int nla_parse_nested(struct nlattr *tb[], int maxtype, | 1044 | static inline int nla_parse_nested_deprecated(struct nlattr *tb[], int maxtype, |
912 | const struct nlattr *nla, | 1045 | const struct nlattr *nla, |
913 | const struct nla_policy *policy, | 1046 | const struct nla_policy *policy, |
914 | struct netlink_ext_ack *extack) | 1047 | struct netlink_ext_ack *extack) |
915 | { | 1048 | { |
916 | return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy, | 1049 | return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy, |
917 | extack); | 1050 | NL_VALIDATE_LIBERAL, extack); |
918 | } | 1051 | } |
919 | 1052 | ||
920 | /** | 1053 | /** |
@@ -1489,6 +1622,7 @@ static inline void nla_nest_cancel(struct sk_buff *skb, struct nlattr *start) | |||
1489 | * @start: container attribute | 1622 | * @start: container attribute |
1490 | * @maxtype: maximum attribute type to be expected | 1623 | * @maxtype: maximum attribute type to be expected |
1491 | * @policy: validation policy | 1624 | * @policy: validation policy |
1625 | * @validate: validation strictness | ||
1492 | * @extack: extended ACK report struct | 1626 | * @extack: extended ACK report struct |
1493 | * | 1627 | * |
1494 | * Validates all attributes in the nested attribute stream against the | 1628 | * Validates all attributes in the nested attribute stream against the |
@@ -1497,12 +1631,22 @@ static inline void nla_nest_cancel(struct sk_buff *skb, struct nlattr *start) | |||
1497 | * | 1631 | * |
1498 | * Returns 0 on success or a negative error code. | 1632 | * Returns 0 on success or a negative error code. |
1499 | */ | 1633 | */ |
1500 | static inline int nla_validate_nested(const struct nlattr *start, int maxtype, | 1634 | static inline int __nla_validate_nested(const struct nlattr *start, int maxtype, |
1501 | const struct nla_policy *policy, | 1635 | const struct nla_policy *policy, |
1502 | struct netlink_ext_ack *extack) | 1636 | unsigned int validate, |
1637 | struct netlink_ext_ack *extack) | ||
1638 | { | ||
1639 | return __nla_validate(nla_data(start), nla_len(start), maxtype, policy, | ||
1640 | validate, extack); | ||
1641 | } | ||
1642 | |||
1643 | static inline int | ||
1644 | nla_validate_nested_deprecated(const struct nlattr *start, int maxtype, | ||
1645 | const struct nla_policy *policy, | ||
1646 | struct netlink_ext_ack *extack) | ||
1503 | { | 1647 | { |
1504 | return nla_validate(nla_data(start), nla_len(start), maxtype, policy, | 1648 | return __nla_validate_nested(start, maxtype, policy, |
1505 | extack); | 1649 | NL_VALIDATE_LIBERAL, extack); |
1506 | } | 1650 | } |
1507 | 1651 | ||
1508 | /** | 1652 | /** |
diff --git a/kernel/taskstats.c b/kernel/taskstats.c index ef4f9cd980fd..0e347f1c7800 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c | |||
@@ -677,8 +677,9 @@ static int taskstats_pre_doit(const struct genl_ops *ops, struct sk_buff *skb, | |||
677 | return -EINVAL; | 677 | return -EINVAL; |
678 | } | 678 | } |
679 | 679 | ||
680 | return nlmsg_validate(info->nlhdr, GENL_HDRLEN, TASKSTATS_CMD_ATTR_MAX, | 680 | return nlmsg_validate_deprecated(info->nlhdr, GENL_HDRLEN, |
681 | policy, info->extack); | 681 | TASKSTATS_CMD_ATTR_MAX, policy, |
682 | info->extack); | ||
682 | } | 683 | } |
683 | 684 | ||
684 | static struct genl_family family __ro_after_init = { | 685 | static struct genl_family family __ro_after_init = { |
diff --git a/lib/nlattr.c b/lib/nlattr.c index 465c9e8ef8a5..af0f8b0309c6 100644 --- a/lib/nlattr.c +++ b/lib/nlattr.c | |||
@@ -69,7 +69,8 @@ static int validate_nla_bitfield32(const struct nlattr *nla, | |||
69 | 69 | ||
70 | static int nla_validate_array(const struct nlattr *head, int len, int maxtype, | 70 | static int nla_validate_array(const struct nlattr *head, int len, int maxtype, |
71 | const struct nla_policy *policy, | 71 | const struct nla_policy *policy, |
72 | struct netlink_ext_ack *extack) | 72 | struct netlink_ext_ack *extack, |
73 | unsigned int validate) | ||
73 | { | 74 | { |
74 | const struct nlattr *entry; | 75 | const struct nlattr *entry; |
75 | int rem; | 76 | int rem; |
@@ -86,8 +87,8 @@ static int nla_validate_array(const struct nlattr *head, int len, int maxtype, | |||
86 | return -ERANGE; | 87 | return -ERANGE; |
87 | } | 88 | } |
88 | 89 | ||
89 | ret = nla_validate(nla_data(entry), nla_len(entry), | 90 | ret = __nla_validate(nla_data(entry), nla_len(entry), |
90 | maxtype, policy, extack); | 91 | maxtype, policy, validate, extack); |
91 | if (ret < 0) | 92 | if (ret < 0) |
92 | return ret; | 93 | return ret; |
93 | } | 94 | } |
@@ -154,7 +155,7 @@ static int nla_validate_int_range(const struct nla_policy *pt, | |||
154 | } | 155 | } |
155 | 156 | ||
156 | static int validate_nla(const struct nlattr *nla, int maxtype, | 157 | static int validate_nla(const struct nlattr *nla, int maxtype, |
157 | const struct nla_policy *policy, | 158 | const struct nla_policy *policy, unsigned int validate, |
158 | struct netlink_ext_ack *extack) | 159 | struct netlink_ext_ack *extack) |
159 | { | 160 | { |
160 | const struct nla_policy *pt; | 161 | const struct nla_policy *pt; |
@@ -172,6 +173,11 @@ static int validate_nla(const struct nlattr *nla, int maxtype, | |||
172 | (pt->type == NLA_EXACT_LEN_WARN && attrlen != pt->len)) { | 173 | (pt->type == NLA_EXACT_LEN_WARN && attrlen != pt->len)) { |
173 | pr_warn_ratelimited("netlink: '%s': attribute type %d has an invalid length.\n", | 174 | pr_warn_ratelimited("netlink: '%s': attribute type %d has an invalid length.\n", |
174 | current->comm, type); | 175 | current->comm, type); |
176 | if (validate & NL_VALIDATE_STRICT_ATTRS) { | ||
177 | NL_SET_ERR_MSG_ATTR(extack, nla, | ||
178 | "invalid attribute length"); | ||
179 | return -EINVAL; | ||
180 | } | ||
175 | } | 181 | } |
176 | 182 | ||
177 | switch (pt->type) { | 183 | switch (pt->type) { |
@@ -244,8 +250,9 @@ static int validate_nla(const struct nlattr *nla, int maxtype, | |||
244 | if (attrlen < NLA_HDRLEN) | 250 | if (attrlen < NLA_HDRLEN) |
245 | goto out_err; | 251 | goto out_err; |
246 | if (pt->validation_data) { | 252 | if (pt->validation_data) { |
247 | err = nla_validate(nla_data(nla), nla_len(nla), pt->len, | 253 | err = __nla_validate(nla_data(nla), nla_len(nla), pt->len, |
248 | pt->validation_data, extack); | 254 | pt->validation_data, validate, |
255 | extack); | ||
249 | if (err < 0) { | 256 | if (err < 0) { |
250 | /* | 257 | /* |
251 | * return directly to preserve the inner | 258 | * return directly to preserve the inner |
@@ -268,7 +275,7 @@ static int validate_nla(const struct nlattr *nla, int maxtype, | |||
268 | 275 | ||
269 | err = nla_validate_array(nla_data(nla), nla_len(nla), | 276 | err = nla_validate_array(nla_data(nla), nla_len(nla), |
270 | pt->len, pt->validation_data, | 277 | pt->len, pt->validation_data, |
271 | extack); | 278 | extack, validate); |
272 | if (err < 0) { | 279 | if (err < 0) { |
273 | /* | 280 | /* |
274 | * return directly to preserve the inner | 281 | * return directly to preserve the inner |
@@ -280,6 +287,12 @@ static int validate_nla(const struct nlattr *nla, int maxtype, | |||
280 | break; | 287 | break; |
281 | 288 | ||
282 | case NLA_UNSPEC: | 289 | case NLA_UNSPEC: |
290 | if (validate & NL_VALIDATE_UNSPEC) { | ||
291 | NL_SET_ERR_MSG_ATTR(extack, nla, | ||
292 | "Unsupported attribute"); | ||
293 | return -EINVAL; | ||
294 | } | ||
295 | /* fall through */ | ||
283 | case NLA_MIN_LEN: | 296 | case NLA_MIN_LEN: |
284 | if (attrlen < pt->len) | 297 | if (attrlen < pt->len) |
285 | goto out_err; | 298 | goto out_err; |
@@ -322,37 +335,75 @@ out_err: | |||
322 | return err; | 335 | return err; |
323 | } | 336 | } |
324 | 337 | ||
338 | static int __nla_validate_parse(const struct nlattr *head, int len, int maxtype, | ||
339 | const struct nla_policy *policy, | ||
340 | unsigned int validate, | ||
341 | struct netlink_ext_ack *extack, | ||
342 | struct nlattr **tb) | ||
343 | { | ||
344 | const struct nlattr *nla; | ||
345 | int rem; | ||
346 | |||
347 | if (tb) | ||
348 | memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); | ||
349 | |||
350 | nla_for_each_attr(nla, head, len, rem) { | ||
351 | u16 type = nla_type(nla); | ||
352 | |||
353 | if (type == 0 || type > maxtype) { | ||
354 | if (validate & NL_VALIDATE_MAXTYPE) { | ||
355 | NL_SET_ERR_MSG(extack, "Unknown attribute type"); | ||
356 | return -EINVAL; | ||
357 | } | ||
358 | continue; | ||
359 | } | ||
360 | if (policy) { | ||
361 | int err = validate_nla(nla, maxtype, policy, | ||
362 | validate, extack); | ||
363 | |||
364 | if (err < 0) | ||
365 | return err; | ||
366 | } | ||
367 | |||
368 | if (tb) | ||
369 | tb[type] = (struct nlattr *)nla; | ||
370 | } | ||
371 | |||
372 | if (unlikely(rem > 0)) { | ||
373 | pr_warn_ratelimited("netlink: %d bytes leftover after parsing attributes in process `%s'.\n", | ||
374 | rem, current->comm); | ||
375 | NL_SET_ERR_MSG(extack, "bytes leftover after parsing attributes"); | ||
376 | if (validate & NL_VALIDATE_TRAILING) | ||
377 | return -EINVAL; | ||
378 | } | ||
379 | |||
380 | return 0; | ||
381 | } | ||
382 | |||
325 | /** | 383 | /** |
326 | * nla_validate - Validate a stream of attributes | 384 | * __nla_validate - Validate a stream of attributes |
327 | * @head: head of attribute stream | 385 | * @head: head of attribute stream |
328 | * @len: length of attribute stream | 386 | * @len: length of attribute stream |
329 | * @maxtype: maximum attribute type to be expected | 387 | * @maxtype: maximum attribute type to be expected |
330 | * @policy: validation policy | 388 | * @policy: validation policy |
389 | * @validate: validation strictness | ||
331 | * @extack: extended ACK report struct | 390 | * @extack: extended ACK report struct |
332 | * | 391 | * |
333 | * Validates all attributes in the specified attribute stream against the | 392 | * Validates all attributes in the specified attribute stream against the |
334 | * specified policy. Attributes with a type exceeding maxtype will be | 393 | * specified policy. Validation depends on the validate flags passed, see |
335 | * ignored. See documenation of struct nla_policy for more details. | 394 | * &enum netlink_validation for more details on that. |
395 | * See documenation of struct nla_policy for more details. | ||
336 | * | 396 | * |
337 | * Returns 0 on success or a negative error code. | 397 | * Returns 0 on success or a negative error code. |
338 | */ | 398 | */ |
339 | int nla_validate(const struct nlattr *head, int len, int maxtype, | 399 | int __nla_validate(const struct nlattr *head, int len, int maxtype, |
340 | const struct nla_policy *policy, | 400 | const struct nla_policy *policy, unsigned int validate, |
341 | struct netlink_ext_ack *extack) | 401 | struct netlink_ext_ack *extack) |
342 | { | 402 | { |
343 | const struct nlattr *nla; | 403 | return __nla_validate_parse(head, len, maxtype, policy, validate, |
344 | int rem; | 404 | extack, NULL); |
345 | |||
346 | nla_for_each_attr(nla, head, len, rem) { | ||
347 | int err = validate_nla(nla, maxtype, policy, extack); | ||
348 | |||
349 | if (err < 0) | ||
350 | return err; | ||
351 | } | ||
352 | |||
353 | return 0; | ||
354 | } | 405 | } |
355 | EXPORT_SYMBOL(nla_validate); | 406 | EXPORT_SYMBOL(__nla_validate); |
356 | 407 | ||
357 | /** | 408 | /** |
358 | * nla_policy_len - Determin the max. length of a policy | 409 | * nla_policy_len - Determin the max. length of a policy |
@@ -384,76 +435,30 @@ nla_policy_len(const struct nla_policy *p, int n) | |||
384 | EXPORT_SYMBOL(nla_policy_len); | 435 | EXPORT_SYMBOL(nla_policy_len); |
385 | 436 | ||
386 | /** | 437 | /** |
387 | * nla_parse - Parse a stream of attributes into a tb buffer | 438 | * __nla_parse - Parse a stream of attributes into a tb buffer |
388 | * @tb: destination array with maxtype+1 elements | 439 | * @tb: destination array with maxtype+1 elements |
389 | * @maxtype: maximum attribute type to be expected | 440 | * @maxtype: maximum attribute type to be expected |
390 | * @head: head of attribute stream | 441 | * @head: head of attribute stream |
391 | * @len: length of attribute stream | 442 | * @len: length of attribute stream |
392 | * @policy: validation policy | 443 | * @policy: validation policy |
444 | * @validate: validation strictness | ||
445 | * @extack: extended ACK pointer | ||
393 | * | 446 | * |
394 | * Parses a stream of attributes and stores a pointer to each attribute in | 447 | * Parses a stream of attributes and stores a pointer to each attribute in |
395 | * the tb array accessible via the attribute type. Attributes with a type | 448 | * the tb array accessible via the attribute type. |
396 | * exceeding maxtype will be silently ignored for backwards compatibility | 449 | * Validation is controlled by the @validate parameter. |
397 | * reasons. policy may be set to NULL if no validation is required. | ||
398 | * | 450 | * |
399 | * Returns 0 on success or a negative error code. | 451 | * Returns 0 on success or a negative error code. |
400 | */ | 452 | */ |
401 | static int __nla_parse(struct nlattr **tb, int maxtype, | 453 | int __nla_parse(struct nlattr **tb, int maxtype, |
402 | const struct nlattr *head, int len, | 454 | const struct nlattr *head, int len, |
403 | bool strict, const struct nla_policy *policy, | 455 | const struct nla_policy *policy, unsigned int validate, |
404 | struct netlink_ext_ack *extack) | 456 | struct netlink_ext_ack *extack) |
405 | { | ||
406 | const struct nlattr *nla; | ||
407 | int rem; | ||
408 | |||
409 | memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); | ||
410 | |||
411 | nla_for_each_attr(nla, head, len, rem) { | ||
412 | u16 type = nla_type(nla); | ||
413 | |||
414 | if (type == 0 || type > maxtype) { | ||
415 | if (strict) { | ||
416 | NL_SET_ERR_MSG(extack, "Unknown attribute type"); | ||
417 | return -EINVAL; | ||
418 | } | ||
419 | continue; | ||
420 | } | ||
421 | if (policy) { | ||
422 | int err = validate_nla(nla, maxtype, policy, extack); | ||
423 | |||
424 | if (err < 0) | ||
425 | return err; | ||
426 | } | ||
427 | |||
428 | tb[type] = (struct nlattr *)nla; | ||
429 | } | ||
430 | |||
431 | if (unlikely(rem > 0)) { | ||
432 | pr_warn_ratelimited("netlink: %d bytes leftover after parsing attributes in process `%s'.\n", | ||
433 | rem, current->comm); | ||
434 | NL_SET_ERR_MSG(extack, "bytes leftover after parsing attributes"); | ||
435 | if (strict) | ||
436 | return -EINVAL; | ||
437 | } | ||
438 | |||
439 | return 0; | ||
440 | } | ||
441 | |||
442 | int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head, | ||
443 | int len, const struct nla_policy *policy, | ||
444 | struct netlink_ext_ack *extack) | ||
445 | { | ||
446 | return __nla_parse(tb, maxtype, head, len, false, policy, extack); | ||
447 | } | ||
448 | EXPORT_SYMBOL(nla_parse); | ||
449 | |||
450 | int nla_parse_strict(struct nlattr **tb, int maxtype, const struct nlattr *head, | ||
451 | int len, const struct nla_policy *policy, | ||
452 | struct netlink_ext_ack *extack) | ||
453 | { | 457 | { |
454 | return __nla_parse(tb, maxtype, head, len, true, policy, extack); | 458 | return __nla_validate_parse(head, len, maxtype, policy, validate, |
459 | extack, tb); | ||
455 | } | 460 | } |
456 | EXPORT_SYMBOL(nla_parse_strict); | 461 | EXPORT_SYMBOL(__nla_parse); |
457 | 462 | ||
458 | /** | 463 | /** |
459 | * nla_find - Find a specific attribute in a stream of attributes | 464 | * nla_find - Find a specific attribute in a stream of attributes |
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c index ab4921e7797b..24eebbc92364 100644 --- a/net/8021q/vlan_netlink.c +++ b/net/8021q/vlan_netlink.c | |||
@@ -35,8 +35,8 @@ static inline int vlan_validate_qos_map(struct nlattr *attr) | |||
35 | { | 35 | { |
36 | if (!attr) | 36 | if (!attr) |
37 | return 0; | 37 | return 0; |
38 | return nla_validate_nested(attr, IFLA_VLAN_QOS_MAX, vlan_map_policy, | 38 | return nla_validate_nested_deprecated(attr, IFLA_VLAN_QOS_MAX, |
39 | NULL); | 39 | vlan_map_policy, NULL); |
40 | } | 40 | } |
41 | 41 | ||
42 | static int vlan_validate(struct nlattr *tb[], struct nlattr *data[], | 42 | static int vlan_validate(struct nlattr *tb[], struct nlattr *data[], |
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index 3619c1a12a77..bf6acd34234d 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c | |||
@@ -530,8 +530,8 @@ static int br_mdb_parse(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
530 | struct net_device *dev; | 530 | struct net_device *dev; |
531 | int err; | 531 | int err; |
532 | 532 | ||
533 | err = nlmsg_parse(nlh, sizeof(*bpm), tb, MDBA_SET_ENTRY_MAX, NULL, | 533 | err = nlmsg_parse_deprecated(nlh, sizeof(*bpm), tb, |
534 | NULL); | 534 | MDBA_SET_ENTRY_MAX, NULL, NULL); |
535 | if (err < 0) | 535 | if (err < 0) |
536 | return err; | 536 | return err; |
537 | 537 | ||
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index 348ddb6d09bb..a5acad29cd4f 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -880,8 +880,10 @@ int br_setlink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags, | |||
880 | 880 | ||
881 | if (p && protinfo) { | 881 | if (p && protinfo) { |
882 | if (protinfo->nla_type & NLA_F_NESTED) { | 882 | if (protinfo->nla_type & NLA_F_NESTED) { |
883 | err = nla_parse_nested(tb, IFLA_BRPORT_MAX, protinfo, | 883 | err = nla_parse_nested_deprecated(tb, IFLA_BRPORT_MAX, |
884 | br_port_policy, NULL); | 884 | protinfo, |
885 | br_port_policy, | ||
886 | NULL); | ||
885 | if (err) | 887 | if (err) |
886 | return err; | 888 | return err; |
887 | 889 | ||
diff --git a/net/bridge/br_netlink_tunnel.c b/net/bridge/br_netlink_tunnel.c index 787e140dc4b5..34629d558709 100644 --- a/net/bridge/br_netlink_tunnel.c +++ b/net/bridge/br_netlink_tunnel.c | |||
@@ -230,8 +230,8 @@ int br_parse_vlan_tunnel_info(struct nlattr *attr, | |||
230 | 230 | ||
231 | memset(tinfo, 0, sizeof(*tinfo)); | 231 | memset(tinfo, 0, sizeof(*tinfo)); |
232 | 232 | ||
233 | err = nla_parse_nested(tb, IFLA_BRIDGE_VLAN_TUNNEL_MAX, attr, | 233 | err = nla_parse_nested_deprecated(tb, IFLA_BRIDGE_VLAN_TUNNEL_MAX, |
234 | vlan_tunnel_policy, NULL); | 234 | attr, vlan_tunnel_policy, NULL); |
235 | if (err < 0) | 235 | if (err < 0) |
236 | return err; | 236 | return err; |
237 | 237 | ||
diff --git a/net/can/gw.c b/net/can/gw.c index 53859346dc9a..5275ddf580bc 100644 --- a/net/can/gw.c +++ b/net/can/gw.c | |||
@@ -662,8 +662,8 @@ static int cgw_parse_attr(struct nlmsghdr *nlh, struct cf_mod *mod, | |||
662 | /* initialize modification & checksum data space */ | 662 | /* initialize modification & checksum data space */ |
663 | memset(mod, 0, sizeof(*mod)); | 663 | memset(mod, 0, sizeof(*mod)); |
664 | 664 | ||
665 | err = nlmsg_parse(nlh, sizeof(struct rtcanmsg), tb, CGW_MAX, | 665 | err = nlmsg_parse_deprecated(nlh, sizeof(struct rtcanmsg), tb, |
666 | cgw_policy, NULL); | 666 | CGW_MAX, cgw_policy, NULL); |
667 | if (err < 0) | 667 | if (err < 0) |
668 | return err; | 668 | return err; |
669 | 669 | ||
diff --git a/net/core/devlink.c b/net/core/devlink.c index b94f326f5f06..b020d182c9fc 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c | |||
@@ -3674,9 +3674,10 @@ static int devlink_nl_cmd_region_read_dumpit(struct sk_buff *skb, | |||
3674 | if (!attrs) | 3674 | if (!attrs) |
3675 | return -ENOMEM; | 3675 | return -ENOMEM; |
3676 | 3676 | ||
3677 | err = nlmsg_parse(cb->nlh, GENL_HDRLEN + devlink_nl_family.hdrsize, | 3677 | err = nlmsg_parse_deprecated(cb->nlh, |
3678 | attrs, DEVLINK_ATTR_MAX, devlink_nl_family.policy, | 3678 | GENL_HDRLEN + devlink_nl_family.hdrsize, |
3679 | cb->extack); | 3679 | attrs, DEVLINK_ATTR_MAX, |
3680 | devlink_nl_family.policy, cb->extack); | ||
3680 | if (err) | 3681 | if (err) |
3681 | goto out_free; | 3682 | goto out_free; |
3682 | 3683 | ||
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index ffbb827723a2..18f8dd8329ed 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -746,7 +746,8 @@ int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
746 | goto errout; | 746 | goto errout; |
747 | } | 747 | } |
748 | 748 | ||
749 | err = nlmsg_parse(nlh, sizeof(*frh), tb, FRA_MAX, ops->policy, extack); | 749 | err = nlmsg_parse_deprecated(nlh, sizeof(*frh), tb, FRA_MAX, |
750 | ops->policy, extack); | ||
750 | if (err < 0) { | 751 | if (err < 0) { |
751 | NL_SET_ERR_MSG(extack, "Error parsing msg"); | 752 | NL_SET_ERR_MSG(extack, "Error parsing msg"); |
752 | goto errout; | 753 | goto errout; |
@@ -853,7 +854,8 @@ int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
853 | goto errout; | 854 | goto errout; |
854 | } | 855 | } |
855 | 856 | ||
856 | err = nlmsg_parse(nlh, sizeof(*frh), tb, FRA_MAX, ops->policy, extack); | 857 | err = nlmsg_parse_deprecated(nlh, sizeof(*frh), tb, FRA_MAX, |
858 | ops->policy, extack); | ||
857 | if (err < 0) { | 859 | if (err < 0) { |
858 | NL_SET_ERR_MSG(extack, "Error parsing msg"); | 860 | NL_SET_ERR_MSG(extack, "Error parsing msg"); |
859 | goto errout; | 861 | goto errout; |
diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c index bbdfc8db1960..1c94f529f4a1 100644 --- a/net/core/lwt_bpf.c +++ b/net/core/lwt_bpf.c | |||
@@ -343,8 +343,8 @@ static int bpf_parse_prog(struct nlattr *attr, struct bpf_lwt_prog *prog, | |||
343 | int ret; | 343 | int ret; |
344 | u32 fd; | 344 | u32 fd; |
345 | 345 | ||
346 | ret = nla_parse_nested(tb, LWT_BPF_PROG_MAX, attr, bpf_prog_policy, | 346 | ret = nla_parse_nested_deprecated(tb, LWT_BPF_PROG_MAX, attr, |
347 | NULL); | 347 | bpf_prog_policy, NULL); |
348 | if (ret < 0) | 348 | if (ret < 0) |
349 | return ret; | 349 | return ret; |
350 | 350 | ||
@@ -385,7 +385,8 @@ static int bpf_build_state(struct nlattr *nla, | |||
385 | if (family != AF_INET && family != AF_INET6) | 385 | if (family != AF_INET && family != AF_INET6) |
386 | return -EAFNOSUPPORT; | 386 | return -EAFNOSUPPORT; |
387 | 387 | ||
388 | ret = nla_parse_nested(tb, LWT_BPF_MAX, nla, bpf_nl_policy, extack); | 388 | ret = nla_parse_nested_deprecated(tb, LWT_BPF_MAX, nla, bpf_nl_policy, |
389 | extack); | ||
389 | if (ret < 0) | 390 | if (ret < 0) |
390 | return ret; | 391 | return ret; |
391 | 392 | ||
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index efd0b53d9ca4..e73bfc63e473 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -1862,7 +1862,8 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1862 | int err; | 1862 | int err; |
1863 | 1863 | ||
1864 | ASSERT_RTNL(); | 1864 | ASSERT_RTNL(); |
1865 | err = nlmsg_parse(nlh, sizeof(*ndm), tb, NDA_MAX, nda_policy, extack); | 1865 | err = nlmsg_parse_deprecated(nlh, sizeof(*ndm), tb, NDA_MAX, |
1866 | nda_policy, extack); | ||
1866 | if (err < 0) | 1867 | if (err < 0) |
1867 | goto out; | 1868 | goto out; |
1868 | 1869 | ||
@@ -2181,8 +2182,8 @@ static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
2181 | bool found = false; | 2182 | bool found = false; |
2182 | int err, tidx; | 2183 | int err, tidx; |
2183 | 2184 | ||
2184 | err = nlmsg_parse(nlh, sizeof(*ndtmsg), tb, NDTA_MAX, | 2185 | err = nlmsg_parse_deprecated(nlh, sizeof(*ndtmsg), tb, NDTA_MAX, |
2185 | nl_neightbl_policy, extack); | 2186 | nl_neightbl_policy, extack); |
2186 | if (err < 0) | 2187 | if (err < 0) |
2187 | goto errout; | 2188 | goto errout; |
2188 | 2189 | ||
@@ -2219,8 +2220,9 @@ static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
2219 | struct neigh_parms *p; | 2220 | struct neigh_parms *p; |
2220 | int i, ifindex = 0; | 2221 | int i, ifindex = 0; |
2221 | 2222 | ||
2222 | err = nla_parse_nested(tbp, NDTPA_MAX, tb[NDTA_PARMS], | 2223 | err = nla_parse_nested_deprecated(tbp, NDTPA_MAX, |
2223 | nl_ntbl_parm_policy, extack); | 2224 | tb[NDTA_PARMS], |
2225 | nl_ntbl_parm_policy, extack); | ||
2224 | if (err < 0) | 2226 | if (err < 0) |
2225 | goto errout_tbl_lock; | 2227 | goto errout_tbl_lock; |
2226 | 2228 | ||
@@ -2660,11 +2662,12 @@ static int neigh_valid_dump_req(const struct nlmsghdr *nlh, | |||
2660 | return -EINVAL; | 2662 | return -EINVAL; |
2661 | } | 2663 | } |
2662 | 2664 | ||
2663 | err = nlmsg_parse_strict(nlh, sizeof(struct ndmsg), tb, NDA_MAX, | 2665 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct ndmsg), |
2664 | nda_policy, extack); | 2666 | tb, NDA_MAX, nda_policy, |
2667 | extack); | ||
2665 | } else { | 2668 | } else { |
2666 | err = nlmsg_parse(nlh, sizeof(struct ndmsg), tb, NDA_MAX, | 2669 | err = nlmsg_parse_deprecated(nlh, sizeof(struct ndmsg), tb, |
2667 | nda_policy, extack); | 2670 | NDA_MAX, nda_policy, extack); |
2668 | } | 2671 | } |
2669 | if (err < 0) | 2672 | if (err < 0) |
2670 | return err; | 2673 | return err; |
@@ -2764,8 +2767,8 @@ static int neigh_valid_get_req(const struct nlmsghdr *nlh, | |||
2764 | return -EINVAL; | 2767 | return -EINVAL; |
2765 | } | 2768 | } |
2766 | 2769 | ||
2767 | err = nlmsg_parse_strict(nlh, sizeof(struct ndmsg), tb, NDA_MAX, | 2770 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct ndmsg), tb, |
2768 | nda_policy, extack); | 2771 | NDA_MAX, nda_policy, extack); |
2769 | if (err < 0) | 2772 | if (err < 0) |
2770 | return err; | 2773 | return err; |
2771 | 2774 | ||
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index ebb5b6d21a13..711b161505ac 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -682,8 +682,8 @@ static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
682 | struct net *peer; | 682 | struct net *peer; |
683 | int nsid, err; | 683 | int nsid, err; |
684 | 684 | ||
685 | err = nlmsg_parse(nlh, sizeof(struct rtgenmsg), tb, NETNSA_MAX, | 685 | err = nlmsg_parse_deprecated(nlh, sizeof(struct rtgenmsg), tb, |
686 | rtnl_net_policy, extack); | 686 | NETNSA_MAX, rtnl_net_policy, extack); |
687 | if (err < 0) | 687 | if (err < 0) |
688 | return err; | 688 | return err; |
689 | if (!tb[NETNSA_NSID]) { | 689 | if (!tb[NETNSA_NSID]) { |
@@ -787,11 +787,13 @@ static int rtnl_net_valid_getid_req(struct sk_buff *skb, | |||
787 | int i, err; | 787 | int i, err; |
788 | 788 | ||
789 | if (!netlink_strict_get_check(skb)) | 789 | if (!netlink_strict_get_check(skb)) |
790 | return nlmsg_parse(nlh, sizeof(struct rtgenmsg), tb, NETNSA_MAX, | 790 | return nlmsg_parse_deprecated(nlh, sizeof(struct rtgenmsg), |
791 | rtnl_net_policy, extack); | 791 | tb, NETNSA_MAX, rtnl_net_policy, |
792 | extack); | ||
792 | 793 | ||
793 | err = nlmsg_parse_strict(nlh, sizeof(struct rtgenmsg), tb, NETNSA_MAX, | 794 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct rtgenmsg), tb, |
794 | rtnl_net_policy, extack); | 795 | NETNSA_MAX, rtnl_net_policy, |
796 | extack); | ||
795 | if (err) | 797 | if (err) |
796 | return err; | 798 | return err; |
797 | 799 | ||
@@ -929,8 +931,9 @@ static int rtnl_valid_dump_net_req(const struct nlmsghdr *nlh, struct sock *sk, | |||
929 | struct nlattr *tb[NETNSA_MAX + 1]; | 931 | struct nlattr *tb[NETNSA_MAX + 1]; |
930 | int err, i; | 932 | int err, i; |
931 | 933 | ||
932 | err = nlmsg_parse_strict(nlh, sizeof(struct rtgenmsg), tb, NETNSA_MAX, | 934 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct rtgenmsg), tb, |
933 | rtnl_net_policy, extack); | 935 | NETNSA_MAX, rtnl_net_policy, |
936 | extack); | ||
934 | if (err < 0) | 937 | if (err < 0) |
935 | return err; | 938 | return err; |
936 | 939 | ||
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 8ad44b299e72..2bd12afb9297 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -1797,8 +1797,7 @@ static const struct rtnl_link_ops *linkinfo_to_kind_ops(const struct nlattr *nla | |||
1797 | const struct rtnl_link_ops *ops = NULL; | 1797 | const struct rtnl_link_ops *ops = NULL; |
1798 | struct nlattr *linfo[IFLA_INFO_MAX + 1]; | 1798 | struct nlattr *linfo[IFLA_INFO_MAX + 1]; |
1799 | 1799 | ||
1800 | if (nla_parse_nested(linfo, IFLA_INFO_MAX, nla, | 1800 | if (nla_parse_nested_deprecated(linfo, IFLA_INFO_MAX, nla, ifla_info_policy, NULL) < 0) |
1801 | ifla_info_policy, NULL) < 0) | ||
1802 | return NULL; | 1801 | return NULL; |
1803 | 1802 | ||
1804 | if (linfo[IFLA_INFO_KIND]) { | 1803 | if (linfo[IFLA_INFO_KIND]) { |
@@ -1897,8 +1896,9 @@ static int rtnl_valid_dump_ifinfo_req(const struct nlmsghdr *nlh, | |||
1897 | return -EINVAL; | 1896 | return -EINVAL; |
1898 | } | 1897 | } |
1899 | 1898 | ||
1900 | return nlmsg_parse_strict(nlh, sizeof(*ifm), tb, IFLA_MAX, | 1899 | return nlmsg_parse_deprecated_strict(nlh, sizeof(*ifm), tb, |
1901 | ifla_policy, extack); | 1900 | IFLA_MAX, ifla_policy, |
1901 | extack); | ||
1902 | } | 1902 | } |
1903 | 1903 | ||
1904 | /* A hack to preserve kernel<->userspace interface. | 1904 | /* A hack to preserve kernel<->userspace interface. |
@@ -1911,7 +1911,8 @@ static int rtnl_valid_dump_ifinfo_req(const struct nlmsghdr *nlh, | |||
1911 | hdrlen = nlmsg_len(nlh) < sizeof(struct ifinfomsg) ? | 1911 | hdrlen = nlmsg_len(nlh) < sizeof(struct ifinfomsg) ? |
1912 | sizeof(struct rtgenmsg) : sizeof(struct ifinfomsg); | 1912 | sizeof(struct rtgenmsg) : sizeof(struct ifinfomsg); |
1913 | 1913 | ||
1914 | return nlmsg_parse(nlh, hdrlen, tb, IFLA_MAX, ifla_policy, extack); | 1914 | return nlmsg_parse_deprecated(nlh, hdrlen, tb, IFLA_MAX, ifla_policy, |
1915 | extack); | ||
1915 | } | 1916 | } |
1916 | 1917 | ||
1917 | static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) | 1918 | static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) |
@@ -2019,7 +2020,8 @@ out_err: | |||
2019 | int rtnl_nla_parse_ifla(struct nlattr **tb, const struct nlattr *head, int len, | 2020 | int rtnl_nla_parse_ifla(struct nlattr **tb, const struct nlattr *head, int len, |
2020 | struct netlink_ext_ack *exterr) | 2021 | struct netlink_ext_ack *exterr) |
2021 | { | 2022 | { |
2022 | return nla_parse(tb, IFLA_MAX, head, len, ifla_policy, exterr); | 2023 | return nla_parse_deprecated(tb, IFLA_MAX, head, len, ifla_policy, |
2024 | exterr); | ||
2023 | } | 2025 | } |
2024 | EXPORT_SYMBOL(rtnl_nla_parse_ifla); | 2026 | EXPORT_SYMBOL(rtnl_nla_parse_ifla); |
2025 | 2027 | ||
@@ -2564,8 +2566,10 @@ static int do_setlink(const struct sk_buff *skb, | |||
2564 | err = -EINVAL; | 2566 | err = -EINVAL; |
2565 | goto errout; | 2567 | goto errout; |
2566 | } | 2568 | } |
2567 | err = nla_parse_nested(vfinfo, IFLA_VF_MAX, attr, | 2569 | err = nla_parse_nested_deprecated(vfinfo, IFLA_VF_MAX, |
2568 | ifla_vf_policy, NULL); | 2570 | attr, |
2571 | ifla_vf_policy, | ||
2572 | NULL); | ||
2569 | if (err < 0) | 2573 | if (err < 0) |
2570 | goto errout; | 2574 | goto errout; |
2571 | err = do_setvfinfo(dev, vfinfo); | 2575 | err = do_setvfinfo(dev, vfinfo); |
@@ -2592,8 +2596,10 @@ static int do_setlink(const struct sk_buff *skb, | |||
2592 | err = -EINVAL; | 2596 | err = -EINVAL; |
2593 | goto errout; | 2597 | goto errout; |
2594 | } | 2598 | } |
2595 | err = nla_parse_nested(port, IFLA_PORT_MAX, attr, | 2599 | err = nla_parse_nested_deprecated(port, IFLA_PORT_MAX, |
2596 | ifla_port_policy, NULL); | 2600 | attr, |
2601 | ifla_port_policy, | ||
2602 | NULL); | ||
2597 | if (err < 0) | 2603 | if (err < 0) |
2598 | goto errout; | 2604 | goto errout; |
2599 | if (!port[IFLA_PORT_VF]) { | 2605 | if (!port[IFLA_PORT_VF]) { |
@@ -2612,9 +2618,9 @@ static int do_setlink(const struct sk_buff *skb, | |||
2612 | if (tb[IFLA_PORT_SELF]) { | 2618 | if (tb[IFLA_PORT_SELF]) { |
2613 | struct nlattr *port[IFLA_PORT_MAX+1]; | 2619 | struct nlattr *port[IFLA_PORT_MAX+1]; |
2614 | 2620 | ||
2615 | err = nla_parse_nested(port, IFLA_PORT_MAX, | 2621 | err = nla_parse_nested_deprecated(port, IFLA_PORT_MAX, |
2616 | tb[IFLA_PORT_SELF], ifla_port_policy, | 2622 | tb[IFLA_PORT_SELF], |
2617 | NULL); | 2623 | ifla_port_policy, NULL); |
2618 | if (err < 0) | 2624 | if (err < 0) |
2619 | goto errout; | 2625 | goto errout; |
2620 | 2626 | ||
@@ -2661,8 +2667,9 @@ static int do_setlink(const struct sk_buff *skb, | |||
2661 | struct nlattr *xdp[IFLA_XDP_MAX + 1]; | 2667 | struct nlattr *xdp[IFLA_XDP_MAX + 1]; |
2662 | u32 xdp_flags = 0; | 2668 | u32 xdp_flags = 0; |
2663 | 2669 | ||
2664 | err = nla_parse_nested(xdp, IFLA_XDP_MAX, tb[IFLA_XDP], | 2670 | err = nla_parse_nested_deprecated(xdp, IFLA_XDP_MAX, |
2665 | ifla_xdp_policy, NULL); | 2671 | tb[IFLA_XDP], |
2672 | ifla_xdp_policy, NULL); | ||
2666 | if (err < 0) | 2673 | if (err < 0) |
2667 | goto errout; | 2674 | goto errout; |
2668 | 2675 | ||
@@ -2716,8 +2723,8 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
2716 | struct nlattr *tb[IFLA_MAX+1]; | 2723 | struct nlattr *tb[IFLA_MAX+1]; |
2717 | char ifname[IFNAMSIZ]; | 2724 | char ifname[IFNAMSIZ]; |
2718 | 2725 | ||
2719 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, | 2726 | err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFLA_MAX, |
2720 | extack); | 2727 | ifla_policy, extack); |
2721 | if (err < 0) | 2728 | if (err < 0) |
2722 | goto errout; | 2729 | goto errout; |
2723 | 2730 | ||
@@ -2813,7 +2820,8 @@ static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
2813 | int err; | 2820 | int err; |
2814 | int netnsid = -1; | 2821 | int netnsid = -1; |
2815 | 2822 | ||
2816 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, extack); | 2823 | err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFLA_MAX, |
2824 | ifla_policy, extack); | ||
2817 | if (err < 0) | 2825 | if (err < 0) |
2818 | return err; | 2826 | return err; |
2819 | 2827 | ||
@@ -2990,7 +2998,8 @@ static int __rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
2990 | #ifdef CONFIG_MODULES | 2998 | #ifdef CONFIG_MODULES |
2991 | replay: | 2999 | replay: |
2992 | #endif | 3000 | #endif |
2993 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, extack); | 3001 | err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFLA_MAX, |
3002 | ifla_policy, extack); | ||
2994 | if (err < 0) | 3003 | if (err < 0) |
2995 | return err; | 3004 | return err; |
2996 | 3005 | ||
@@ -3024,9 +3033,9 @@ replay: | |||
3024 | return err; | 3033 | return err; |
3025 | 3034 | ||
3026 | if (tb[IFLA_LINKINFO]) { | 3035 | if (tb[IFLA_LINKINFO]) { |
3027 | err = nla_parse_nested(linkinfo, IFLA_INFO_MAX, | 3036 | err = nla_parse_nested_deprecated(linkinfo, IFLA_INFO_MAX, |
3028 | tb[IFLA_LINKINFO], ifla_info_policy, | 3037 | tb[IFLA_LINKINFO], |
3029 | NULL); | 3038 | ifla_info_policy, NULL); |
3030 | if (err < 0) | 3039 | if (err < 0) |
3031 | return err; | 3040 | return err; |
3032 | } else | 3041 | } else |
@@ -3046,9 +3055,9 @@ replay: | |||
3046 | return -EINVAL; | 3055 | return -EINVAL; |
3047 | 3056 | ||
3048 | if (ops->maxtype && linkinfo[IFLA_INFO_DATA]) { | 3057 | if (ops->maxtype && linkinfo[IFLA_INFO_DATA]) { |
3049 | err = nla_parse_nested(attr, ops->maxtype, | 3058 | err = nla_parse_nested_deprecated(attr, ops->maxtype, |
3050 | linkinfo[IFLA_INFO_DATA], | 3059 | linkinfo[IFLA_INFO_DATA], |
3051 | ops->policy, extack); | 3060 | ops->policy, extack); |
3052 | if (err < 0) | 3061 | if (err < 0) |
3053 | return err; | 3062 | return err; |
3054 | data = attr; | 3063 | data = attr; |
@@ -3067,9 +3076,11 @@ replay: | |||
3067 | 3076 | ||
3068 | if (m_ops->slave_maxtype && | 3077 | if (m_ops->slave_maxtype && |
3069 | linkinfo[IFLA_INFO_SLAVE_DATA]) { | 3078 | linkinfo[IFLA_INFO_SLAVE_DATA]) { |
3070 | err = nla_parse_nested(slave_attr, m_ops->slave_maxtype, | 3079 | err = nla_parse_nested_deprecated(slave_attr, |
3071 | linkinfo[IFLA_INFO_SLAVE_DATA], | 3080 | m_ops->slave_maxtype, |
3072 | m_ops->slave_policy, extack); | 3081 | linkinfo[IFLA_INFO_SLAVE_DATA], |
3082 | m_ops->slave_policy, | ||
3083 | extack); | ||
3073 | if (err < 0) | 3084 | if (err < 0) |
3074 | return err; | 3085 | return err; |
3075 | slave_data = slave_attr; | 3086 | slave_data = slave_attr; |
@@ -3250,8 +3261,8 @@ static int rtnl_valid_getlink_req(struct sk_buff *skb, | |||
3250 | } | 3261 | } |
3251 | 3262 | ||
3252 | if (!netlink_strict_get_check(skb)) | 3263 | if (!netlink_strict_get_check(skb)) |
3253 | return nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, | 3264 | return nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFLA_MAX, |
3254 | extack); | 3265 | ifla_policy, extack); |
3255 | 3266 | ||
3256 | ifm = nlmsg_data(nlh); | 3267 | ifm = nlmsg_data(nlh); |
3257 | if (ifm->__ifi_pad || ifm->ifi_type || ifm->ifi_flags || | 3268 | if (ifm->__ifi_pad || ifm->ifi_type || ifm->ifi_flags || |
@@ -3260,8 +3271,8 @@ static int rtnl_valid_getlink_req(struct sk_buff *skb, | |||
3260 | return -EINVAL; | 3271 | return -EINVAL; |
3261 | } | 3272 | } |
3262 | 3273 | ||
3263 | err = nlmsg_parse_strict(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, | 3274 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(*ifm), tb, IFLA_MAX, |
3264 | extack); | 3275 | ifla_policy, extack); |
3265 | if (err) | 3276 | if (err) |
3266 | return err; | 3277 | return err; |
3267 | 3278 | ||
@@ -3366,7 +3377,7 @@ static u16 rtnl_calcit(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
3366 | hdrlen = nlmsg_len(nlh) < sizeof(struct ifinfomsg) ? | 3377 | hdrlen = nlmsg_len(nlh) < sizeof(struct ifinfomsg) ? |
3367 | sizeof(struct rtgenmsg) : sizeof(struct ifinfomsg); | 3378 | sizeof(struct rtgenmsg) : sizeof(struct ifinfomsg); |
3368 | 3379 | ||
3369 | if (nlmsg_parse(nlh, hdrlen, tb, IFLA_MAX, ifla_policy, NULL) >= 0) { | 3380 | if (nlmsg_parse_deprecated(nlh, hdrlen, tb, IFLA_MAX, ifla_policy, NULL) >= 0) { |
3370 | if (tb[IFLA_EXT_MASK]) | 3381 | if (tb[IFLA_EXT_MASK]) |
3371 | ext_filter_mask = nla_get_u32(tb[IFLA_EXT_MASK]); | 3382 | ext_filter_mask = nla_get_u32(tb[IFLA_EXT_MASK]); |
3372 | } | 3383 | } |
@@ -3639,7 +3650,8 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
3639 | u16 vid; | 3650 | u16 vid; |
3640 | int err; | 3651 | int err; |
3641 | 3652 | ||
3642 | err = nlmsg_parse(nlh, sizeof(*ndm), tb, NDA_MAX, NULL, extack); | 3653 | err = nlmsg_parse_deprecated(nlh, sizeof(*ndm), tb, NDA_MAX, NULL, |
3654 | extack); | ||
3643 | if (err < 0) | 3655 | if (err < 0) |
3644 | return err; | 3656 | return err; |
3645 | 3657 | ||
@@ -3749,7 +3761,8 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
3749 | if (!netlink_capable(skb, CAP_NET_ADMIN)) | 3761 | if (!netlink_capable(skb, CAP_NET_ADMIN)) |
3750 | return -EPERM; | 3762 | return -EPERM; |
3751 | 3763 | ||
3752 | err = nlmsg_parse(nlh, sizeof(*ndm), tb, NDA_MAX, NULL, extack); | 3764 | err = nlmsg_parse_deprecated(nlh, sizeof(*ndm), tb, NDA_MAX, NULL, |
3765 | extack); | ||
3753 | if (err < 0) | 3766 | if (err < 0) |
3754 | return err; | 3767 | return err; |
3755 | 3768 | ||
@@ -3898,8 +3911,8 @@ static int valid_fdb_dump_strict(const struct nlmsghdr *nlh, | |||
3898 | return -EINVAL; | 3911 | return -EINVAL; |
3899 | } | 3912 | } |
3900 | 3913 | ||
3901 | err = nlmsg_parse_strict(nlh, sizeof(struct ndmsg), tb, NDA_MAX, | 3914 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct ndmsg), tb, |
3902 | NULL, extack); | 3915 | NDA_MAX, NULL, extack); |
3903 | if (err < 0) | 3916 | if (err < 0) |
3904 | return err; | 3917 | return err; |
3905 | 3918 | ||
@@ -3951,8 +3964,9 @@ static int valid_fdb_dump_legacy(const struct nlmsghdr *nlh, | |||
3951 | nla_attr_size(sizeof(u32)))) { | 3964 | nla_attr_size(sizeof(u32)))) { |
3952 | struct ifinfomsg *ifm; | 3965 | struct ifinfomsg *ifm; |
3953 | 3966 | ||
3954 | err = nlmsg_parse(nlh, sizeof(struct ifinfomsg), tb, IFLA_MAX, | 3967 | err = nlmsg_parse_deprecated(nlh, sizeof(struct ifinfomsg), |
3955 | ifla_policy, extack); | 3968 | tb, IFLA_MAX, ifla_policy, |
3969 | extack); | ||
3956 | if (err < 0) { | 3970 | if (err < 0) { |
3957 | return -EINVAL; | 3971 | return -EINVAL; |
3958 | } else if (err == 0) { | 3972 | } else if (err == 0) { |
@@ -4091,8 +4105,8 @@ static int valid_fdb_get_strict(const struct nlmsghdr *nlh, | |||
4091 | return -EINVAL; | 4105 | return -EINVAL; |
4092 | } | 4106 | } |
4093 | 4107 | ||
4094 | err = nlmsg_parse_strict(nlh, sizeof(struct ndmsg), tb, NDA_MAX, | 4108 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct ndmsg), tb, |
4095 | nda_policy, extack); | 4109 | NDA_MAX, nda_policy, extack); |
4096 | if (err < 0) | 4110 | if (err < 0) |
4097 | return err; | 4111 | return err; |
4098 | 4112 | ||
@@ -4354,11 +4368,14 @@ static int valid_bridge_getlink_req(const struct nlmsghdr *nlh, | |||
4354 | return -EINVAL; | 4368 | return -EINVAL; |
4355 | } | 4369 | } |
4356 | 4370 | ||
4357 | err = nlmsg_parse_strict(nlh, sizeof(struct ifinfomsg), tb, | 4371 | err = nlmsg_parse_deprecated_strict(nlh, |
4358 | IFLA_MAX, ifla_policy, extack); | 4372 | sizeof(struct ifinfomsg), |
4373 | tb, IFLA_MAX, ifla_policy, | ||
4374 | extack); | ||
4359 | } else { | 4375 | } else { |
4360 | err = nlmsg_parse(nlh, sizeof(struct ifinfomsg), tb, | 4376 | err = nlmsg_parse_deprecated(nlh, sizeof(struct ifinfomsg), |
4361 | IFLA_MAX, ifla_policy, extack); | 4377 | tb, IFLA_MAX, ifla_policy, |
4378 | extack); | ||
4362 | } | 4379 | } |
4363 | if (err < 0) | 4380 | if (err < 0) |
4364 | return err; | 4381 | return err; |
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index 3fd3aa7348bd..ceff9d22deea 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c | |||
@@ -241,8 +241,9 @@ static int dcbnl_getpfccfg(struct net_device *netdev, struct nlmsghdr *nlh, | |||
241 | if (!netdev->dcbnl_ops->getpfccfg) | 241 | if (!netdev->dcbnl_ops->getpfccfg) |
242 | return -EOPNOTSUPP; | 242 | return -EOPNOTSUPP; |
243 | 243 | ||
244 | ret = nla_parse_nested(data, DCB_PFC_UP_ATTR_MAX, | 244 | ret = nla_parse_nested_deprecated(data, DCB_PFC_UP_ATTR_MAX, |
245 | tb[DCB_ATTR_PFC_CFG], dcbnl_pfc_up_nest, NULL); | 245 | tb[DCB_ATTR_PFC_CFG], |
246 | dcbnl_pfc_up_nest, NULL); | ||
246 | if (ret) | 247 | if (ret) |
247 | return ret; | 248 | return ret; |
248 | 249 | ||
@@ -299,8 +300,9 @@ static int dcbnl_getcap(struct net_device *netdev, struct nlmsghdr *nlh, | |||
299 | if (!netdev->dcbnl_ops->getcap) | 300 | if (!netdev->dcbnl_ops->getcap) |
300 | return -EOPNOTSUPP; | 301 | return -EOPNOTSUPP; |
301 | 302 | ||
302 | ret = nla_parse_nested(data, DCB_CAP_ATTR_MAX, tb[DCB_ATTR_CAP], | 303 | ret = nla_parse_nested_deprecated(data, DCB_CAP_ATTR_MAX, |
303 | dcbnl_cap_nest, NULL); | 304 | tb[DCB_ATTR_CAP], dcbnl_cap_nest, |
305 | NULL); | ||
304 | if (ret) | 306 | if (ret) |
305 | return ret; | 307 | return ret; |
306 | 308 | ||
@@ -343,8 +345,9 @@ static int dcbnl_getnumtcs(struct net_device *netdev, struct nlmsghdr *nlh, | |||
343 | if (!netdev->dcbnl_ops->getnumtcs) | 345 | if (!netdev->dcbnl_ops->getnumtcs) |
344 | return -EOPNOTSUPP; | 346 | return -EOPNOTSUPP; |
345 | 347 | ||
346 | ret = nla_parse_nested(data, DCB_NUMTCS_ATTR_MAX, tb[DCB_ATTR_NUMTCS], | 348 | ret = nla_parse_nested_deprecated(data, DCB_NUMTCS_ATTR_MAX, |
347 | dcbnl_numtcs_nest, NULL); | 349 | tb[DCB_ATTR_NUMTCS], |
350 | dcbnl_numtcs_nest, NULL); | ||
348 | if (ret) | 351 | if (ret) |
349 | return ret; | 352 | return ret; |
350 | 353 | ||
@@ -388,8 +391,9 @@ static int dcbnl_setnumtcs(struct net_device *netdev, struct nlmsghdr *nlh, | |||
388 | if (!netdev->dcbnl_ops->setnumtcs) | 391 | if (!netdev->dcbnl_ops->setnumtcs) |
389 | return -EOPNOTSUPP; | 392 | return -EOPNOTSUPP; |
390 | 393 | ||
391 | ret = nla_parse_nested(data, DCB_NUMTCS_ATTR_MAX, tb[DCB_ATTR_NUMTCS], | 394 | ret = nla_parse_nested_deprecated(data, DCB_NUMTCS_ATTR_MAX, |
392 | dcbnl_numtcs_nest, NULL); | 395 | tb[DCB_ATTR_NUMTCS], |
396 | dcbnl_numtcs_nest, NULL); | ||
393 | if (ret) | 397 | if (ret) |
394 | return ret; | 398 | return ret; |
395 | 399 | ||
@@ -447,8 +451,9 @@ static int dcbnl_getapp(struct net_device *netdev, struct nlmsghdr *nlh, | |||
447 | if (!tb[DCB_ATTR_APP]) | 451 | if (!tb[DCB_ATTR_APP]) |
448 | return -EINVAL; | 452 | return -EINVAL; |
449 | 453 | ||
450 | ret = nla_parse_nested(app_tb, DCB_APP_ATTR_MAX, tb[DCB_ATTR_APP], | 454 | ret = nla_parse_nested_deprecated(app_tb, DCB_APP_ATTR_MAX, |
451 | dcbnl_app_nest, NULL); | 455 | tb[DCB_ATTR_APP], dcbnl_app_nest, |
456 | NULL); | ||
452 | if (ret) | 457 | if (ret) |
453 | return ret; | 458 | return ret; |
454 | 459 | ||
@@ -515,8 +520,9 @@ static int dcbnl_setapp(struct net_device *netdev, struct nlmsghdr *nlh, | |||
515 | if (!tb[DCB_ATTR_APP]) | 520 | if (!tb[DCB_ATTR_APP]) |
516 | return -EINVAL; | 521 | return -EINVAL; |
517 | 522 | ||
518 | ret = nla_parse_nested(app_tb, DCB_APP_ATTR_MAX, tb[DCB_ATTR_APP], | 523 | ret = nla_parse_nested_deprecated(app_tb, DCB_APP_ATTR_MAX, |
519 | dcbnl_app_nest, NULL); | 524 | tb[DCB_ATTR_APP], dcbnl_app_nest, |
525 | NULL); | ||
520 | if (ret) | 526 | if (ret) |
521 | return ret; | 527 | return ret; |
522 | 528 | ||
@@ -573,8 +579,9 @@ static int __dcbnl_pg_getcfg(struct net_device *netdev, struct nlmsghdr *nlh, | |||
573 | !netdev->dcbnl_ops->getpgbwgcfgrx) | 579 | !netdev->dcbnl_ops->getpgbwgcfgrx) |
574 | return -EOPNOTSUPP; | 580 | return -EOPNOTSUPP; |
575 | 581 | ||
576 | ret = nla_parse_nested(pg_tb, DCB_PG_ATTR_MAX, tb[DCB_ATTR_PG_CFG], | 582 | ret = nla_parse_nested_deprecated(pg_tb, DCB_PG_ATTR_MAX, |
577 | dcbnl_pg_nest, NULL); | 583 | tb[DCB_ATTR_PG_CFG], dcbnl_pg_nest, |
584 | NULL); | ||
578 | if (ret) | 585 | if (ret) |
579 | return ret; | 586 | return ret; |
580 | 587 | ||
@@ -593,8 +600,9 @@ static int __dcbnl_pg_getcfg(struct net_device *netdev, struct nlmsghdr *nlh, | |||
593 | data = pg_tb[DCB_PG_ATTR_TC_ALL]; | 600 | data = pg_tb[DCB_PG_ATTR_TC_ALL]; |
594 | else | 601 | else |
595 | data = pg_tb[i]; | 602 | data = pg_tb[i]; |
596 | ret = nla_parse_nested(param_tb, DCB_TC_ATTR_PARAM_MAX, data, | 603 | ret = nla_parse_nested_deprecated(param_tb, |
597 | dcbnl_tc_param_nest, NULL); | 604 | DCB_TC_ATTR_PARAM_MAX, data, |
605 | dcbnl_tc_param_nest, NULL); | ||
598 | if (ret) | 606 | if (ret) |
599 | goto err_pg; | 607 | goto err_pg; |
600 | 608 | ||
@@ -730,8 +738,9 @@ static int dcbnl_setpfccfg(struct net_device *netdev, struct nlmsghdr *nlh, | |||
730 | if (!netdev->dcbnl_ops->setpfccfg) | 738 | if (!netdev->dcbnl_ops->setpfccfg) |
731 | return -EOPNOTSUPP; | 739 | return -EOPNOTSUPP; |
732 | 740 | ||
733 | ret = nla_parse_nested(data, DCB_PFC_UP_ATTR_MAX, | 741 | ret = nla_parse_nested_deprecated(data, DCB_PFC_UP_ATTR_MAX, |
734 | tb[DCB_ATTR_PFC_CFG], dcbnl_pfc_up_nest, NULL); | 742 | tb[DCB_ATTR_PFC_CFG], |
743 | dcbnl_pfc_up_nest, NULL); | ||
735 | if (ret) | 744 | if (ret) |
736 | return ret; | 745 | return ret; |
737 | 746 | ||
@@ -786,8 +795,9 @@ static int __dcbnl_pg_setcfg(struct net_device *netdev, struct nlmsghdr *nlh, | |||
786 | !netdev->dcbnl_ops->setpgbwgcfgrx) | 795 | !netdev->dcbnl_ops->setpgbwgcfgrx) |
787 | return -EOPNOTSUPP; | 796 | return -EOPNOTSUPP; |
788 | 797 | ||
789 | ret = nla_parse_nested(pg_tb, DCB_PG_ATTR_MAX, tb[DCB_ATTR_PG_CFG], | 798 | ret = nla_parse_nested_deprecated(pg_tb, DCB_PG_ATTR_MAX, |
790 | dcbnl_pg_nest, NULL); | 799 | tb[DCB_ATTR_PG_CFG], dcbnl_pg_nest, |
800 | NULL); | ||
791 | if (ret) | 801 | if (ret) |
792 | return ret; | 802 | return ret; |
793 | 803 | ||
@@ -795,8 +805,10 @@ static int __dcbnl_pg_setcfg(struct net_device *netdev, struct nlmsghdr *nlh, | |||
795 | if (!pg_tb[i]) | 805 | if (!pg_tb[i]) |
796 | continue; | 806 | continue; |
797 | 807 | ||
798 | ret = nla_parse_nested(param_tb, DCB_TC_ATTR_PARAM_MAX, | 808 | ret = nla_parse_nested_deprecated(param_tb, |
799 | pg_tb[i], dcbnl_tc_param_nest, NULL); | 809 | DCB_TC_ATTR_PARAM_MAX, |
810 | pg_tb[i], | ||
811 | dcbnl_tc_param_nest, NULL); | ||
800 | if (ret) | 812 | if (ret) |
801 | return ret; | 813 | return ret; |
802 | 814 | ||
@@ -884,8 +896,9 @@ static int dcbnl_bcn_getcfg(struct net_device *netdev, struct nlmsghdr *nlh, | |||
884 | !netdev->dcbnl_ops->getbcncfg) | 896 | !netdev->dcbnl_ops->getbcncfg) |
885 | return -EOPNOTSUPP; | 897 | return -EOPNOTSUPP; |
886 | 898 | ||
887 | ret = nla_parse_nested(bcn_tb, DCB_BCN_ATTR_MAX, tb[DCB_ATTR_BCN], | 899 | ret = nla_parse_nested_deprecated(bcn_tb, DCB_BCN_ATTR_MAX, |
888 | dcbnl_bcn_nest, NULL); | 900 | tb[DCB_ATTR_BCN], dcbnl_bcn_nest, |
901 | NULL); | ||
889 | if (ret) | 902 | if (ret) |
890 | return ret; | 903 | return ret; |
891 | 904 | ||
@@ -943,8 +956,9 @@ static int dcbnl_bcn_setcfg(struct net_device *netdev, struct nlmsghdr *nlh, | |||
943 | !netdev->dcbnl_ops->setbcnrp) | 956 | !netdev->dcbnl_ops->setbcnrp) |
944 | return -EOPNOTSUPP; | 957 | return -EOPNOTSUPP; |
945 | 958 | ||
946 | ret = nla_parse_nested(data, DCB_BCN_ATTR_MAX, tb[DCB_ATTR_BCN], | 959 | ret = nla_parse_nested_deprecated(data, DCB_BCN_ATTR_MAX, |
947 | dcbnl_pfc_up_nest, NULL); | 960 | tb[DCB_ATTR_BCN], dcbnl_pfc_up_nest, |
961 | NULL); | ||
948 | if (ret) | 962 | if (ret) |
949 | return ret; | 963 | return ret; |
950 | 964 | ||
@@ -1431,8 +1445,9 @@ static int dcbnl_ieee_set(struct net_device *netdev, struct nlmsghdr *nlh, | |||
1431 | if (!tb[DCB_ATTR_IEEE]) | 1445 | if (!tb[DCB_ATTR_IEEE]) |
1432 | return -EINVAL; | 1446 | return -EINVAL; |
1433 | 1447 | ||
1434 | err = nla_parse_nested(ieee, DCB_ATTR_IEEE_MAX, tb[DCB_ATTR_IEEE], | 1448 | err = nla_parse_nested_deprecated(ieee, DCB_ATTR_IEEE_MAX, |
1435 | dcbnl_ieee_policy, NULL); | 1449 | tb[DCB_ATTR_IEEE], |
1450 | dcbnl_ieee_policy, NULL); | ||
1436 | if (err) | 1451 | if (err) |
1437 | return err; | 1452 | return err; |
1438 | 1453 | ||
@@ -1531,8 +1546,9 @@ static int dcbnl_ieee_del(struct net_device *netdev, struct nlmsghdr *nlh, | |||
1531 | if (!tb[DCB_ATTR_IEEE]) | 1546 | if (!tb[DCB_ATTR_IEEE]) |
1532 | return -EINVAL; | 1547 | return -EINVAL; |
1533 | 1548 | ||
1534 | err = nla_parse_nested(ieee, DCB_ATTR_IEEE_MAX, tb[DCB_ATTR_IEEE], | 1549 | err = nla_parse_nested_deprecated(ieee, DCB_ATTR_IEEE_MAX, |
1535 | dcbnl_ieee_policy, NULL); | 1550 | tb[DCB_ATTR_IEEE], |
1551 | dcbnl_ieee_policy, NULL); | ||
1536 | if (err) | 1552 | if (err) |
1537 | return err; | 1553 | return err; |
1538 | 1554 | ||
@@ -1604,8 +1620,9 @@ static int dcbnl_getfeatcfg(struct net_device *netdev, struct nlmsghdr *nlh, | |||
1604 | if (!tb[DCB_ATTR_FEATCFG]) | 1620 | if (!tb[DCB_ATTR_FEATCFG]) |
1605 | return -EINVAL; | 1621 | return -EINVAL; |
1606 | 1622 | ||
1607 | ret = nla_parse_nested(data, DCB_FEATCFG_ATTR_MAX, | 1623 | ret = nla_parse_nested_deprecated(data, DCB_FEATCFG_ATTR_MAX, |
1608 | tb[DCB_ATTR_FEATCFG], dcbnl_featcfg_nest, NULL); | 1624 | tb[DCB_ATTR_FEATCFG], |
1625 | dcbnl_featcfg_nest, NULL); | ||
1609 | if (ret) | 1626 | if (ret) |
1610 | return ret; | 1627 | return ret; |
1611 | 1628 | ||
@@ -1648,8 +1665,9 @@ static int dcbnl_setfeatcfg(struct net_device *netdev, struct nlmsghdr *nlh, | |||
1648 | if (!tb[DCB_ATTR_FEATCFG]) | 1665 | if (!tb[DCB_ATTR_FEATCFG]) |
1649 | return -EINVAL; | 1666 | return -EINVAL; |
1650 | 1667 | ||
1651 | ret = nla_parse_nested(data, DCB_FEATCFG_ATTR_MAX, | 1668 | ret = nla_parse_nested_deprecated(data, DCB_FEATCFG_ATTR_MAX, |
1652 | tb[DCB_ATTR_FEATCFG], dcbnl_featcfg_nest, NULL); | 1669 | tb[DCB_ATTR_FEATCFG], |
1670 | dcbnl_featcfg_nest, NULL); | ||
1653 | 1671 | ||
1654 | if (ret) | 1672 | if (ret) |
1655 | goto err; | 1673 | goto err; |
@@ -1738,8 +1756,8 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1738 | if ((nlh->nlmsg_type == RTM_SETDCB) && !netlink_capable(skb, CAP_NET_ADMIN)) | 1756 | if ((nlh->nlmsg_type == RTM_SETDCB) && !netlink_capable(skb, CAP_NET_ADMIN)) |
1739 | return -EPERM; | 1757 | return -EPERM; |
1740 | 1758 | ||
1741 | ret = nlmsg_parse(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX, | 1759 | ret = nlmsg_parse_deprecated(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX, |
1742 | dcbnl_rtnl_policy, extack); | 1760 | dcbnl_rtnl_policy, extack); |
1743 | if (ret < 0) | 1761 | if (ret < 0) |
1744 | return ret; | 1762 | return ret; |
1745 | 1763 | ||
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 0962f9201baa..cca7ae712995 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -583,8 +583,8 @@ static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
583 | if (!net_eq(net, &init_net)) | 583 | if (!net_eq(net, &init_net)) |
584 | goto errout; | 584 | goto errout; |
585 | 585 | ||
586 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy, | 586 | err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, |
587 | extack); | 587 | dn_ifa_policy, extack); |
588 | if (err < 0) | 588 | if (err < 0) |
589 | goto errout; | 589 | goto errout; |
590 | 590 | ||
@@ -629,8 +629,8 @@ static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
629 | if (!net_eq(net, &init_net)) | 629 | if (!net_eq(net, &init_net)) |
630 | return -EINVAL; | 630 | return -EINVAL; |
631 | 631 | ||
632 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy, | 632 | err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, |
633 | extack); | 633 | dn_ifa_policy, extack); |
634 | if (err < 0) | 634 | if (err < 0) |
635 | return err; | 635 | return err; |
636 | 636 | ||
diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c index 7e47ffdd1412..77fbf8e9df4b 100644 --- a/net/decnet/dn_fib.c +++ b/net/decnet/dn_fib.c | |||
@@ -517,8 +517,8 @@ static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
517 | if (!net_eq(net, &init_net)) | 517 | if (!net_eq(net, &init_net)) |
518 | return -EINVAL; | 518 | return -EINVAL; |
519 | 519 | ||
520 | err = nlmsg_parse(nlh, sizeof(*r), attrs, RTA_MAX, rtm_dn_policy, | 520 | err = nlmsg_parse_deprecated(nlh, sizeof(*r), attrs, RTA_MAX, |
521 | extack); | 521 | rtm_dn_policy, extack); |
522 | if (err < 0) | 522 | if (err < 0) |
523 | return err; | 523 | return err; |
524 | 524 | ||
@@ -544,8 +544,8 @@ static int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
544 | if (!net_eq(net, &init_net)) | 544 | if (!net_eq(net, &init_net)) |
545 | return -EINVAL; | 545 | return -EINVAL; |
546 | 546 | ||
547 | err = nlmsg_parse(nlh, sizeof(*r), attrs, RTA_MAX, rtm_dn_policy, | 547 | err = nlmsg_parse_deprecated(nlh, sizeof(*r), attrs, RTA_MAX, |
548 | extack); | 548 | rtm_dn_policy, extack); |
549 | if (err < 0) | 549 | if (err < 0) |
550 | return err; | 550 | return err; |
551 | 551 | ||
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 950613ee7881..664584763c36 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -1651,8 +1651,8 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, | |||
1651 | if (!net_eq(net, &init_net)) | 1651 | if (!net_eq(net, &init_net)) |
1652 | return -EINVAL; | 1652 | return -EINVAL; |
1653 | 1653 | ||
1654 | err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_dn_policy, | 1654 | err = nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, |
1655 | extack); | 1655 | rtm_dn_policy, extack); |
1656 | if (err < 0) | 1656 | if (err < 0) |
1657 | return err; | 1657 | return err; |
1658 | 1658 | ||
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c index 1a002eb85096..4218304cb201 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c | |||
@@ -247,9 +247,11 @@ nl802154_prepare_wpan_dev_dump(struct sk_buff *skb, | |||
247 | rtnl_lock(); | 247 | rtnl_lock(); |
248 | 248 | ||
249 | if (!cb->args[0]) { | 249 | if (!cb->args[0]) { |
250 | err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl802154_fam.hdrsize, | 250 | err = nlmsg_parse_deprecated(cb->nlh, |
251 | genl_family_attrbuf(&nl802154_fam), | 251 | GENL_HDRLEN + nl802154_fam.hdrsize, |
252 | nl802154_fam.maxattr, nl802154_policy, NULL); | 252 | genl_family_attrbuf(&nl802154_fam), |
253 | nl802154_fam.maxattr, | ||
254 | nl802154_policy, NULL); | ||
253 | if (err) | 255 | if (err) |
254 | goto out_unlock; | 256 | goto out_unlock; |
255 | 257 | ||
@@ -562,8 +564,10 @@ static int nl802154_dump_wpan_phy_parse(struct sk_buff *skb, | |||
562 | struct nl802154_dump_wpan_phy_state *state) | 564 | struct nl802154_dump_wpan_phy_state *state) |
563 | { | 565 | { |
564 | struct nlattr **tb = genl_family_attrbuf(&nl802154_fam); | 566 | struct nlattr **tb = genl_family_attrbuf(&nl802154_fam); |
565 | int ret = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl802154_fam.hdrsize, tb, | 567 | int ret = nlmsg_parse_deprecated(cb->nlh, |
566 | nl802154_fam.maxattr, nl802154_policy, NULL); | 568 | GENL_HDRLEN + nl802154_fam.hdrsize, |
569 | tb, nl802154_fam.maxattr, | ||
570 | nl802154_policy, NULL); | ||
567 | 571 | ||
568 | /* TODO check if we can handle error here, | 572 | /* TODO check if we can handle error here, |
569 | * we have no backward compatibility | 573 | * we have no backward compatibility |
@@ -1308,8 +1312,7 @@ ieee802154_llsec_parse_dev_addr(struct nlattr *nla, | |||
1308 | { | 1312 | { |
1309 | struct nlattr *attrs[NL802154_DEV_ADDR_ATTR_MAX + 1]; | 1313 | struct nlattr *attrs[NL802154_DEV_ADDR_ATTR_MAX + 1]; |
1310 | 1314 | ||
1311 | if (!nla || nla_parse_nested(attrs, NL802154_DEV_ADDR_ATTR_MAX, nla, | 1315 | if (!nla || nla_parse_nested_deprecated(attrs, NL802154_DEV_ADDR_ATTR_MAX, nla, nl802154_dev_addr_policy, NULL)) |
1312 | nl802154_dev_addr_policy, NULL)) | ||
1313 | return -EINVAL; | 1316 | return -EINVAL; |
1314 | 1317 | ||
1315 | if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID] || | 1318 | if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID] || |
@@ -1348,8 +1351,7 @@ ieee802154_llsec_parse_key_id(struct nlattr *nla, | |||
1348 | { | 1351 | { |
1349 | struct nlattr *attrs[NL802154_KEY_ID_ATTR_MAX + 1]; | 1352 | struct nlattr *attrs[NL802154_KEY_ID_ATTR_MAX + 1]; |
1350 | 1353 | ||
1351 | if (!nla || nla_parse_nested(attrs, NL802154_KEY_ID_ATTR_MAX, nla, | 1354 | if (!nla || nla_parse_nested_deprecated(attrs, NL802154_KEY_ID_ATTR_MAX, nla, nl802154_key_id_policy, NULL)) |
1352 | nl802154_key_id_policy, NULL)) | ||
1353 | return -EINVAL; | 1355 | return -EINVAL; |
1354 | 1356 | ||
1355 | if (!attrs[NL802154_KEY_ID_ATTR_MODE]) | 1357 | if (!attrs[NL802154_KEY_ID_ATTR_MODE]) |
@@ -1564,9 +1566,7 @@ static int nl802154_add_llsec_key(struct sk_buff *skb, struct genl_info *info) | |||
1564 | struct ieee802154_llsec_key_id id = { }; | 1566 | struct ieee802154_llsec_key_id id = { }; |
1565 | u32 commands[NL802154_CMD_FRAME_NR_IDS / 32] = { }; | 1567 | u32 commands[NL802154_CMD_FRAME_NR_IDS / 32] = { }; |
1566 | 1568 | ||
1567 | if (nla_parse_nested(attrs, NL802154_KEY_ATTR_MAX, | 1569 | if (nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) |
1568 | info->attrs[NL802154_ATTR_SEC_KEY], | ||
1569 | nl802154_key_policy, info->extack)) | ||
1570 | return -EINVAL; | 1570 | return -EINVAL; |
1571 | 1571 | ||
1572 | if (!attrs[NL802154_KEY_ATTR_USAGE_FRAMES] || | 1572 | if (!attrs[NL802154_KEY_ATTR_USAGE_FRAMES] || |
@@ -1614,9 +1614,7 @@ static int nl802154_del_llsec_key(struct sk_buff *skb, struct genl_info *info) | |||
1614 | struct nlattr *attrs[NL802154_KEY_ATTR_MAX + 1]; | 1614 | struct nlattr *attrs[NL802154_KEY_ATTR_MAX + 1]; |
1615 | struct ieee802154_llsec_key_id id; | 1615 | struct ieee802154_llsec_key_id id; |
1616 | 1616 | ||
1617 | if (nla_parse_nested(attrs, NL802154_KEY_ATTR_MAX, | 1617 | if (nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) |
1618 | info->attrs[NL802154_ATTR_SEC_KEY], | ||
1619 | nl802154_key_policy, info->extack)) | ||
1620 | return -EINVAL; | 1618 | return -EINVAL; |
1621 | 1619 | ||
1622 | if (ieee802154_llsec_parse_key_id(attrs[NL802154_KEY_ATTR_ID], &id) < 0) | 1620 | if (ieee802154_llsec_parse_key_id(attrs[NL802154_KEY_ATTR_ID], &id) < 0) |
@@ -1730,8 +1728,7 @@ ieee802154_llsec_parse_device(struct nlattr *nla, | |||
1730 | { | 1728 | { |
1731 | struct nlattr *attrs[NL802154_DEV_ATTR_MAX + 1]; | 1729 | struct nlattr *attrs[NL802154_DEV_ATTR_MAX + 1]; |
1732 | 1730 | ||
1733 | if (!nla || nla_parse_nested(attrs, NL802154_DEV_ATTR_MAX, | 1731 | if (!nla || nla_parse_nested_deprecated(attrs, NL802154_DEV_ATTR_MAX, nla, nl802154_dev_policy, NULL)) |
1734 | nla, nl802154_dev_policy, NULL)) | ||
1735 | return -EINVAL; | 1732 | return -EINVAL; |
1736 | 1733 | ||
1737 | memset(dev, 0, sizeof(*dev)); | 1734 | memset(dev, 0, sizeof(*dev)); |
@@ -1782,9 +1779,7 @@ static int nl802154_del_llsec_dev(struct sk_buff *skb, struct genl_info *info) | |||
1782 | struct nlattr *attrs[NL802154_DEV_ATTR_MAX + 1]; | 1779 | struct nlattr *attrs[NL802154_DEV_ATTR_MAX + 1]; |
1783 | __le64 extended_addr; | 1780 | __le64 extended_addr; |
1784 | 1781 | ||
1785 | if (nla_parse_nested(attrs, NL802154_DEV_ATTR_MAX, | 1782 | if (nla_parse_nested_deprecated(attrs, NL802154_DEV_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVICE], nl802154_dev_policy, info->extack)) |
1786 | info->attrs[NL802154_ATTR_SEC_DEVICE], | ||
1787 | nl802154_dev_policy, info->extack)) | ||
1788 | return -EINVAL; | 1783 | return -EINVAL; |
1789 | 1784 | ||
1790 | if (!attrs[NL802154_DEV_ATTR_EXTENDED_ADDR]) | 1785 | if (!attrs[NL802154_DEV_ATTR_EXTENDED_ADDR]) |
@@ -1910,9 +1905,7 @@ static int nl802154_add_llsec_devkey(struct sk_buff *skb, struct genl_info *info | |||
1910 | __le64 extended_addr; | 1905 | __le64 extended_addr; |
1911 | 1906 | ||
1912 | if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] || | 1907 | if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] || |
1913 | nla_parse_nested(attrs, NL802154_DEVKEY_ATTR_MAX, | 1908 | nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack) < 0) |
1914 | info->attrs[NL802154_ATTR_SEC_DEVKEY], | ||
1915 | nl802154_devkey_policy, info->extack) < 0) | ||
1916 | return -EINVAL; | 1909 | return -EINVAL; |
1917 | 1910 | ||
1918 | if (!attrs[NL802154_DEVKEY_ATTR_FRAME_COUNTER] || | 1911 | if (!attrs[NL802154_DEVKEY_ATTR_FRAME_COUNTER] || |
@@ -1942,9 +1935,7 @@ static int nl802154_del_llsec_devkey(struct sk_buff *skb, struct genl_info *info | |||
1942 | struct ieee802154_llsec_device_key key; | 1935 | struct ieee802154_llsec_device_key key; |
1943 | __le64 extended_addr; | 1936 | __le64 extended_addr; |
1944 | 1937 | ||
1945 | if (nla_parse_nested(attrs, NL802154_DEVKEY_ATTR_MAX, | 1938 | if (nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack)) |
1946 | info->attrs[NL802154_ATTR_SEC_DEVKEY], | ||
1947 | nl802154_devkey_policy, info->extack)) | ||
1948 | return -EINVAL; | 1939 | return -EINVAL; |
1949 | 1940 | ||
1950 | if (!attrs[NL802154_DEVKEY_ATTR_EXTENDED_ADDR]) | 1941 | if (!attrs[NL802154_DEVKEY_ATTR_EXTENDED_ADDR]) |
@@ -2064,8 +2055,7 @@ llsec_parse_seclevel(struct nlattr *nla, struct ieee802154_llsec_seclevel *sl) | |||
2064 | { | 2055 | { |
2065 | struct nlattr *attrs[NL802154_SECLEVEL_ATTR_MAX + 1]; | 2056 | struct nlattr *attrs[NL802154_SECLEVEL_ATTR_MAX + 1]; |
2066 | 2057 | ||
2067 | if (!nla || nla_parse_nested(attrs, NL802154_SECLEVEL_ATTR_MAX, | 2058 | if (!nla || nla_parse_nested_deprecated(attrs, NL802154_SECLEVEL_ATTR_MAX, nla, nl802154_seclevel_policy, NULL)) |
2068 | nla, nl802154_seclevel_policy, NULL)) | ||
2069 | return -EINVAL; | 2059 | return -EINVAL; |
2070 | 2060 | ||
2071 | memset(sl, 0, sizeof(*sl)); | 2061 | memset(sl, 0, sizeof(*sl)); |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index eb514f312e6f..701c5d113a34 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -621,8 +621,8 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
621 | 621 | ||
622 | ASSERT_RTNL(); | 622 | ASSERT_RTNL(); |
623 | 623 | ||
624 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv4_policy, | 624 | err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, |
625 | extack); | 625 | ifa_ipv4_policy, extack); |
626 | if (err < 0) | 626 | if (err < 0) |
627 | goto errout; | 627 | goto errout; |
628 | 628 | ||
@@ -793,8 +793,8 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh, | |||
793 | struct in_device *in_dev; | 793 | struct in_device *in_dev; |
794 | int err; | 794 | int err; |
795 | 795 | ||
796 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv4_policy, | 796 | err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, |
797 | extack); | 797 | ifa_ipv4_policy, extack); |
798 | if (err < 0) | 798 | if (err < 0) |
799 | goto errout; | 799 | goto errout; |
800 | 800 | ||
@@ -1689,8 +1689,8 @@ static int inet_valid_dump_ifaddr_req(const struct nlmsghdr *nlh, | |||
1689 | fillargs->flags |= NLM_F_DUMP_FILTERED; | 1689 | fillargs->flags |= NLM_F_DUMP_FILTERED; |
1690 | } | 1690 | } |
1691 | 1691 | ||
1692 | err = nlmsg_parse_strict(nlh, sizeof(*ifm), tb, IFA_MAX, | 1692 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(*ifm), tb, IFA_MAX, |
1693 | ifa_ipv4_policy, extack); | 1693 | ifa_ipv4_policy, extack); |
1694 | if (err < 0) | 1694 | if (err < 0) |
1695 | return err; | 1695 | return err; |
1696 | 1696 | ||
@@ -1906,7 +1906,8 @@ static int inet_validate_link_af(const struct net_device *dev, | |||
1906 | if (dev && !__in_dev_get_rcu(dev)) | 1906 | if (dev && !__in_dev_get_rcu(dev)) |
1907 | return -EAFNOSUPPORT; | 1907 | return -EAFNOSUPPORT; |
1908 | 1908 | ||
1909 | err = nla_parse_nested(tb, IFLA_INET_MAX, nla, inet_af_policy, NULL); | 1909 | err = nla_parse_nested_deprecated(tb, IFLA_INET_MAX, nla, |
1910 | inet_af_policy, NULL); | ||
1910 | if (err < 0) | 1911 | if (err < 0) |
1911 | return err; | 1912 | return err; |
1912 | 1913 | ||
@@ -1934,7 +1935,7 @@ static int inet_set_link_af(struct net_device *dev, const struct nlattr *nla) | |||
1934 | if (!in_dev) | 1935 | if (!in_dev) |
1935 | return -EAFNOSUPPORT; | 1936 | return -EAFNOSUPPORT; |
1936 | 1937 | ||
1937 | if (nla_parse_nested(tb, IFLA_INET_MAX, nla, NULL, NULL) < 0) | 1938 | if (nla_parse_nested_deprecated(tb, IFLA_INET_MAX, nla, NULL, NULL) < 0) |
1938 | BUG(); | 1939 | BUG(); |
1939 | 1940 | ||
1940 | if (tb[IFLA_INET_CONF]) { | 1941 | if (tb[IFLA_INET_CONF]) { |
@@ -2076,11 +2077,13 @@ static int inet_netconf_valid_get_req(struct sk_buff *skb, | |||
2076 | } | 2077 | } |
2077 | 2078 | ||
2078 | if (!netlink_strict_get_check(skb)) | 2079 | if (!netlink_strict_get_check(skb)) |
2079 | return nlmsg_parse(nlh, sizeof(struct netconfmsg), tb, | 2080 | return nlmsg_parse_deprecated(nlh, sizeof(struct netconfmsg), |
2080 | NETCONFA_MAX, devconf_ipv4_policy, extack); | 2081 | tb, NETCONFA_MAX, |
2082 | devconf_ipv4_policy, extack); | ||
2081 | 2083 | ||
2082 | err = nlmsg_parse_strict(nlh, sizeof(struct netconfmsg), tb, | 2084 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct netconfmsg), |
2083 | NETCONFA_MAX, devconf_ipv4_policy, extack); | 2085 | tb, NETCONFA_MAX, |
2086 | devconf_ipv4_policy, extack); | ||
2084 | if (err) | 2087 | if (err) |
2085 | return err; | 2088 | return err; |
2086 | 2089 | ||
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index d4b63f94f7be..b298255f6fdb 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -718,8 +718,8 @@ static int rtm_to_fib_config(struct net *net, struct sk_buff *skb, | |||
718 | int err, remaining; | 718 | int err, remaining; |
719 | struct rtmsg *rtm; | 719 | struct rtmsg *rtm; |
720 | 720 | ||
721 | err = nlmsg_validate(nlh, sizeof(*rtm), RTA_MAX, rtm_ipv4_policy, | 721 | err = nlmsg_validate_deprecated(nlh, sizeof(*rtm), RTA_MAX, |
722 | extack); | 722 | rtm_ipv4_policy, extack); |
723 | if (err < 0) | 723 | if (err < 0) |
724 | goto errout; | 724 | goto errout; |
725 | 725 | ||
@@ -896,8 +896,8 @@ int ip_valid_fib_dump_req(struct net *net, const struct nlmsghdr *nlh, | |||
896 | filter->rt_type = rtm->rtm_type; | 896 | filter->rt_type = rtm->rtm_type; |
897 | filter->table_id = rtm->rtm_table; | 897 | filter->table_id = rtm->rtm_table; |
898 | 898 | ||
899 | err = nlmsg_parse_strict(nlh, sizeof(*rtm), tb, RTA_MAX, | 899 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(*rtm), tb, RTA_MAX, |
900 | rtm_ipv4_policy, extack); | 900 | rtm_ipv4_policy, extack); |
901 | if (err < 0) | 901 | if (err < 0) |
902 | return err; | 902 | return err; |
903 | 903 | ||
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c index c3f3d28d1087..30c1c264bdfc 100644 --- a/net/ipv4/ip_tunnel_core.c +++ b/net/ipv4/ip_tunnel_core.c | |||
@@ -239,8 +239,8 @@ static int ip_tun_build_state(struct nlattr *attr, | |||
239 | struct nlattr *tb[LWTUNNEL_IP_MAX + 1]; | 239 | struct nlattr *tb[LWTUNNEL_IP_MAX + 1]; |
240 | int err; | 240 | int err; |
241 | 241 | ||
242 | err = nla_parse_nested(tb, LWTUNNEL_IP_MAX, attr, ip_tun_policy, | 242 | err = nla_parse_nested_deprecated(tb, LWTUNNEL_IP_MAX, attr, |
243 | extack); | 243 | ip_tun_policy, extack); |
244 | if (err < 0) | 244 | if (err < 0) |
245 | return err; | 245 | return err; |
246 | 246 | ||
@@ -356,8 +356,8 @@ static int ip6_tun_build_state(struct nlattr *attr, | |||
356 | struct nlattr *tb[LWTUNNEL_IP6_MAX + 1]; | 356 | struct nlattr *tb[LWTUNNEL_IP6_MAX + 1]; |
357 | int err; | 357 | int err; |
358 | 358 | ||
359 | err = nla_parse_nested(tb, LWTUNNEL_IP6_MAX, attr, ip6_tun_policy, | 359 | err = nla_parse_nested_deprecated(tb, LWTUNNEL_IP6_MAX, attr, |
360 | extack); | 360 | ip6_tun_policy, extack); |
361 | if (err < 0) | 361 | if (err < 0) |
362 | return err; | 362 | return err; |
363 | 363 | ||
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 1322573b8228..2c61e10a60e3 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -2498,8 +2498,8 @@ static int ipmr_rtm_valid_getroute_req(struct sk_buff *skb, | |||
2498 | } | 2498 | } |
2499 | 2499 | ||
2500 | if (!netlink_strict_get_check(skb)) | 2500 | if (!netlink_strict_get_check(skb)) |
2501 | return nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, | 2501 | return nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, |
2502 | rtm_ipv4_policy, extack); | 2502 | rtm_ipv4_policy, extack); |
2503 | 2503 | ||
2504 | rtm = nlmsg_data(nlh); | 2504 | rtm = nlmsg_data(nlh); |
2505 | if ((rtm->rtm_src_len && rtm->rtm_src_len != 32) || | 2505 | if ((rtm->rtm_src_len && rtm->rtm_src_len != 32) || |
@@ -2510,8 +2510,8 @@ static int ipmr_rtm_valid_getroute_req(struct sk_buff *skb, | |||
2510 | return -EINVAL; | 2510 | return -EINVAL; |
2511 | } | 2511 | } |
2512 | 2512 | ||
2513 | err = nlmsg_parse_strict(nlh, sizeof(*rtm), tb, RTA_MAX, | 2513 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(*rtm), tb, RTA_MAX, |
2514 | rtm_ipv4_policy, extack); | 2514 | rtm_ipv4_policy, extack); |
2515 | if (err) | 2515 | if (err) |
2516 | return err; | 2516 | return err; |
2517 | 2517 | ||
@@ -2674,8 +2674,8 @@ static int rtm_to_ipmr_mfcc(struct net *net, struct nlmsghdr *nlh, | |||
2674 | struct rtmsg *rtm; | 2674 | struct rtmsg *rtm; |
2675 | int ret, rem; | 2675 | int ret, rem; |
2676 | 2676 | ||
2677 | ret = nlmsg_validate(nlh, sizeof(*rtm), RTA_MAX, rtm_ipmr_policy, | 2677 | ret = nlmsg_validate_deprecated(nlh, sizeof(*rtm), RTA_MAX, |
2678 | extack); | 2678 | rtm_ipmr_policy, extack); |
2679 | if (ret < 0) | 2679 | if (ret < 0) |
2680 | goto out; | 2680 | goto out; |
2681 | rtm = nlmsg_data(nlh); | 2681 | rtm = nlmsg_data(nlh); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 4950adeb05c0..795aed6e4720 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2877,8 +2877,8 @@ static int inet_rtm_valid_getroute_req(struct sk_buff *skb, | |||
2877 | } | 2877 | } |
2878 | 2878 | ||
2879 | if (!netlink_strict_get_check(skb)) | 2879 | if (!netlink_strict_get_check(skb)) |
2880 | return nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, | 2880 | return nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, |
2881 | rtm_ipv4_policy, extack); | 2881 | rtm_ipv4_policy, extack); |
2882 | 2882 | ||
2883 | rtm = nlmsg_data(nlh); | 2883 | rtm = nlmsg_data(nlh); |
2884 | if ((rtm->rtm_src_len && rtm->rtm_src_len != 32) || | 2884 | if ((rtm->rtm_src_len && rtm->rtm_src_len != 32) || |
@@ -2896,8 +2896,8 @@ static int inet_rtm_valid_getroute_req(struct sk_buff *skb, | |||
2896 | return -EINVAL; | 2896 | return -EINVAL; |
2897 | } | 2897 | } |
2898 | 2898 | ||
2899 | err = nlmsg_parse_strict(nlh, sizeof(*rtm), tb, RTA_MAX, | 2899 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(*rtm), tb, RTA_MAX, |
2900 | rtm_ipv4_policy, extack); | 2900 | rtm_ipv4_policy, extack); |
2901 | if (err) | 2901 | if (err) |
2902 | return err; | 2902 | return err; |
2903 | 2903 | ||
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 01f081aa718c..f96d1de79509 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -611,11 +611,13 @@ static int inet6_netconf_valid_get_req(struct sk_buff *skb, | |||
611 | } | 611 | } |
612 | 612 | ||
613 | if (!netlink_strict_get_check(skb)) | 613 | if (!netlink_strict_get_check(skb)) |
614 | return nlmsg_parse(nlh, sizeof(struct netconfmsg), tb, | 614 | return nlmsg_parse_deprecated(nlh, sizeof(struct netconfmsg), |
615 | NETCONFA_MAX, devconf_ipv6_policy, extack); | 615 | tb, NETCONFA_MAX, |
616 | devconf_ipv6_policy, extack); | ||
616 | 617 | ||
617 | err = nlmsg_parse_strict(nlh, sizeof(struct netconfmsg), tb, | 618 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct netconfmsg), |
618 | NETCONFA_MAX, devconf_ipv6_policy, extack); | 619 | tb, NETCONFA_MAX, |
620 | devconf_ipv6_policy, extack); | ||
619 | if (err) | 621 | if (err) |
620 | return err; | 622 | return err; |
621 | 623 | ||
@@ -4565,8 +4567,8 @@ inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
4565 | u32 ifa_flags; | 4567 | u32 ifa_flags; |
4566 | int err; | 4568 | int err; |
4567 | 4569 | ||
4568 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv6_policy, | 4570 | err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, |
4569 | extack); | 4571 | ifa_ipv6_policy, extack); |
4570 | if (err < 0) | 4572 | if (err < 0) |
4571 | return err; | 4573 | return err; |
4572 | 4574 | ||
@@ -4729,8 +4731,8 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
4729 | struct ifa6_config cfg; | 4731 | struct ifa6_config cfg; |
4730 | int err; | 4732 | int err; |
4731 | 4733 | ||
4732 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv6_policy, | 4734 | err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, |
4733 | extack); | 4735 | ifa_ipv6_policy, extack); |
4734 | if (err < 0) | 4736 | if (err < 0) |
4735 | return err; | 4737 | return err; |
4736 | 4738 | ||
@@ -5086,8 +5088,8 @@ static int inet6_valid_dump_ifaddr_req(const struct nlmsghdr *nlh, | |||
5086 | fillargs->flags |= NLM_F_DUMP_FILTERED; | 5088 | fillargs->flags |= NLM_F_DUMP_FILTERED; |
5087 | } | 5089 | } |
5088 | 5090 | ||
5089 | err = nlmsg_parse_strict(nlh, sizeof(*ifm), tb, IFA_MAX, | 5091 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(*ifm), tb, IFA_MAX, |
5090 | ifa_ipv6_policy, extack); | 5092 | ifa_ipv6_policy, extack); |
5091 | if (err < 0) | 5093 | if (err < 0) |
5092 | return err; | 5094 | return err; |
5093 | 5095 | ||
@@ -5237,11 +5239,11 @@ static int inet6_rtm_valid_getaddr_req(struct sk_buff *skb, | |||
5237 | } | 5239 | } |
5238 | 5240 | ||
5239 | if (!netlink_strict_get_check(skb)) | 5241 | if (!netlink_strict_get_check(skb)) |
5240 | return nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, | 5242 | return nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, |
5241 | ifa_ipv6_policy, extack); | 5243 | ifa_ipv6_policy, extack); |
5242 | 5244 | ||
5243 | err = nlmsg_parse_strict(nlh, sizeof(*ifm), tb, IFA_MAX, | 5245 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(*ifm), tb, IFA_MAX, |
5244 | ifa_ipv6_policy, extack); | 5246 | ifa_ipv6_policy, extack); |
5245 | if (err) | 5247 | if (err) |
5246 | return err; | 5248 | return err; |
5247 | 5249 | ||
@@ -5667,8 +5669,8 @@ static int inet6_validate_link_af(const struct net_device *dev, | |||
5667 | if (dev && !__in6_dev_get(dev)) | 5669 | if (dev && !__in6_dev_get(dev)) |
5668 | return -EAFNOSUPPORT; | 5670 | return -EAFNOSUPPORT; |
5669 | 5671 | ||
5670 | return nla_parse_nested(tb, IFLA_INET6_MAX, nla, inet6_af_policy, | 5672 | return nla_parse_nested_deprecated(tb, IFLA_INET6_MAX, nla, |
5671 | NULL); | 5673 | inet6_af_policy, NULL); |
5672 | } | 5674 | } |
5673 | 5675 | ||
5674 | static int check_addr_gen_mode(int mode) | 5676 | static int check_addr_gen_mode(int mode) |
@@ -5700,7 +5702,7 @@ static int inet6_set_link_af(struct net_device *dev, const struct nlattr *nla) | |||
5700 | if (!idev) | 5702 | if (!idev) |
5701 | return -EAFNOSUPPORT; | 5703 | return -EAFNOSUPPORT; |
5702 | 5704 | ||
5703 | if (nla_parse_nested(tb, IFLA_INET6_MAX, nla, NULL, NULL) < 0) | 5705 | if (nla_parse_nested_deprecated(tb, IFLA_INET6_MAX, nla, NULL, NULL) < 0) |
5704 | BUG(); | 5706 | BUG(); |
5705 | 5707 | ||
5706 | if (tb[IFLA_INET6_TOKEN]) { | 5708 | if (tb[IFLA_INET6_TOKEN]) { |
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c index 1766325423b5..642fc6ac13d2 100644 --- a/net/ipv6/addrlabel.c +++ b/net/ipv6/addrlabel.c | |||
@@ -383,8 +383,8 @@ static int ip6addrlbl_newdel(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
383 | u32 label; | 383 | u32 label; |
384 | int err = 0; | 384 | int err = 0; |
385 | 385 | ||
386 | err = nlmsg_parse(nlh, sizeof(*ifal), tb, IFAL_MAX, ifal_policy, | 386 | err = nlmsg_parse_deprecated(nlh, sizeof(*ifal), tb, IFAL_MAX, |
387 | extack); | 387 | ifal_policy, extack); |
388 | if (err < 0) | 388 | if (err < 0) |
389 | return err; | 389 | return err; |
390 | 390 | ||
@@ -537,8 +537,8 @@ static int ip6addrlbl_valid_get_req(struct sk_buff *skb, | |||
537 | } | 537 | } |
538 | 538 | ||
539 | if (!netlink_strict_get_check(skb)) | 539 | if (!netlink_strict_get_check(skb)) |
540 | return nlmsg_parse(nlh, sizeof(*ifal), tb, IFAL_MAX, | 540 | return nlmsg_parse_deprecated(nlh, sizeof(*ifal), tb, |
541 | ifal_policy, extack); | 541 | IFAL_MAX, ifal_policy, extack); |
542 | 542 | ||
543 | ifal = nlmsg_data(nlh); | 543 | ifal = nlmsg_data(nlh); |
544 | if (ifal->__ifal_reserved || ifal->ifal_flags || ifal->ifal_seq) { | 544 | if (ifal->__ifal_reserved || ifal->ifal_flags || ifal->ifal_seq) { |
@@ -546,8 +546,8 @@ static int ip6addrlbl_valid_get_req(struct sk_buff *skb, | |||
546 | return -EINVAL; | 546 | return -EINVAL; |
547 | } | 547 | } |
548 | 548 | ||
549 | err = nlmsg_parse_strict(nlh, sizeof(*ifal), tb, IFAL_MAX, | 549 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(*ifal), tb, IFAL_MAX, |
550 | ifal_policy, extack); | 550 | ifal_policy, extack); |
551 | if (err) | 551 | if (err) |
552 | return err; | 552 | return err; |
553 | 553 | ||
diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c index 3d56a2fb6f86..422dcc691f71 100644 --- a/net/ipv6/ila/ila_lwt.c +++ b/net/ipv6/ila/ila_lwt.c | |||
@@ -146,7 +146,8 @@ static int ila_build_state(struct nlattr *nla, | |||
146 | if (family != AF_INET6) | 146 | if (family != AF_INET6) |
147 | return -EINVAL; | 147 | return -EINVAL; |
148 | 148 | ||
149 | ret = nla_parse_nested(tb, ILA_ATTR_MAX, nla, ila_nl_policy, extack); | 149 | ret = nla_parse_nested_deprecated(tb, ILA_ATTR_MAX, nla, |
150 | ila_nl_policy, extack); | ||
150 | if (ret < 0) | 151 | if (ret < 0) |
151 | return ret; | 152 | return ret; |
152 | 153 | ||
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index e2b47f47de92..b18e85cd7587 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -4239,8 +4239,8 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
4239 | unsigned int pref; | 4239 | unsigned int pref; |
4240 | int err; | 4240 | int err; |
4241 | 4241 | ||
4242 | err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy, | 4242 | err = nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, |
4243 | extack); | 4243 | rtm_ipv6_policy, extack); |
4244 | if (err < 0) | 4244 | if (err < 0) |
4245 | goto errout; | 4245 | goto errout; |
4246 | 4246 | ||
@@ -4886,8 +4886,8 @@ static int inet6_rtm_valid_getroute_req(struct sk_buff *skb, | |||
4886 | } | 4886 | } |
4887 | 4887 | ||
4888 | if (!netlink_strict_get_check(skb)) | 4888 | if (!netlink_strict_get_check(skb)) |
4889 | return nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, | 4889 | return nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, |
4890 | rtm_ipv6_policy, extack); | 4890 | rtm_ipv6_policy, extack); |
4891 | 4891 | ||
4892 | rtm = nlmsg_data(nlh); | 4892 | rtm = nlmsg_data(nlh); |
4893 | if ((rtm->rtm_src_len && rtm->rtm_src_len != 128) || | 4893 | if ((rtm->rtm_src_len && rtm->rtm_src_len != 128) || |
@@ -4903,8 +4903,8 @@ static int inet6_rtm_valid_getroute_req(struct sk_buff *skb, | |||
4903 | return -EINVAL; | 4903 | return -EINVAL; |
4904 | } | 4904 | } |
4905 | 4905 | ||
4906 | err = nlmsg_parse_strict(nlh, sizeof(*rtm), tb, RTA_MAX, | 4906 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(*rtm), tb, RTA_MAX, |
4907 | rtm_ipv6_policy, extack); | 4907 | rtm_ipv6_policy, extack); |
4908 | if (err) | 4908 | if (err) |
4909 | return err; | 4909 | return err; |
4910 | 4910 | ||
diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c index ee5403cbe655..7a525fda8978 100644 --- a/net/ipv6/seg6_iptunnel.c +++ b/net/ipv6/seg6_iptunnel.c | |||
@@ -396,8 +396,8 @@ static int seg6_build_state(struct nlattr *nla, | |||
396 | if (family != AF_INET && family != AF_INET6) | 396 | if (family != AF_INET && family != AF_INET6) |
397 | return -EINVAL; | 397 | return -EINVAL; |
398 | 398 | ||
399 | err = nla_parse_nested(tb, SEG6_IPTUNNEL_MAX, nla, | 399 | err = nla_parse_nested_deprecated(tb, SEG6_IPTUNNEL_MAX, nla, |
400 | seg6_iptunnel_policy, extack); | 400 | seg6_iptunnel_policy, extack); |
401 | 401 | ||
402 | if (err < 0) | 402 | if (err < 0) |
403 | return err; | 403 | return err; |
diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c index 67005ac71341..78155fdb8c36 100644 --- a/net/ipv6/seg6_local.c +++ b/net/ipv6/seg6_local.c | |||
@@ -823,8 +823,9 @@ static int parse_nla_bpf(struct nlattr **attrs, struct seg6_local_lwt *slwt) | |||
823 | int ret; | 823 | int ret; |
824 | u32 fd; | 824 | u32 fd; |
825 | 825 | ||
826 | ret = nla_parse_nested(tb, SEG6_LOCAL_BPF_PROG_MAX, | 826 | ret = nla_parse_nested_deprecated(tb, SEG6_LOCAL_BPF_PROG_MAX, |
827 | attrs[SEG6_LOCAL_BPF], bpf_prog_policy, NULL); | 827 | attrs[SEG6_LOCAL_BPF], |
828 | bpf_prog_policy, NULL); | ||
828 | if (ret < 0) | 829 | if (ret < 0) |
829 | return ret; | 830 | return ret; |
830 | 831 | ||
@@ -959,8 +960,8 @@ static int seg6_local_build_state(struct nlattr *nla, unsigned int family, | |||
959 | if (family != AF_INET6) | 960 | if (family != AF_INET6) |
960 | return -EINVAL; | 961 | return -EINVAL; |
961 | 962 | ||
962 | err = nla_parse_nested(tb, SEG6_LOCAL_MAX, nla, seg6_local_policy, | 963 | err = nla_parse_nested_deprecated(tb, SEG6_LOCAL_MAX, nla, |
963 | extack); | 964 | seg6_local_policy, extack); |
964 | 965 | ||
965 | if (err < 0) | 966 | if (err < 0) |
966 | return err; | 967 | return err; |
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c index 01f8a4f97872..baa098291fb0 100644 --- a/net/mpls/af_mpls.c +++ b/net/mpls/af_mpls.c | |||
@@ -1223,11 +1223,13 @@ static int mpls_netconf_valid_get_req(struct sk_buff *skb, | |||
1223 | } | 1223 | } |
1224 | 1224 | ||
1225 | if (!netlink_strict_get_check(skb)) | 1225 | if (!netlink_strict_get_check(skb)) |
1226 | return nlmsg_parse(nlh, sizeof(struct netconfmsg), tb, | 1226 | return nlmsg_parse_deprecated(nlh, sizeof(struct netconfmsg), |
1227 | NETCONFA_MAX, devconf_mpls_policy, extack); | 1227 | tb, NETCONFA_MAX, |
1228 | devconf_mpls_policy, extack); | ||
1228 | 1229 | ||
1229 | err = nlmsg_parse_strict(nlh, sizeof(struct netconfmsg), tb, | 1230 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct netconfmsg), |
1230 | NETCONFA_MAX, devconf_mpls_policy, extack); | 1231 | tb, NETCONFA_MAX, |
1232 | devconf_mpls_policy, extack); | ||
1231 | if (err) | 1233 | if (err) |
1232 | return err; | 1234 | return err; |
1233 | 1235 | ||
@@ -1788,8 +1790,8 @@ static int rtm_to_route_config(struct sk_buff *skb, | |||
1788 | int index; | 1790 | int index; |
1789 | int err; | 1791 | int err; |
1790 | 1792 | ||
1791 | err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_mpls_policy, | 1793 | err = nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, |
1792 | extack); | 1794 | rtm_mpls_policy, extack); |
1793 | if (err < 0) | 1795 | if (err < 0) |
1794 | goto errout; | 1796 | goto errout; |
1795 | 1797 | ||
@@ -2106,8 +2108,8 @@ static int mpls_valid_fib_dump_req(struct net *net, const struct nlmsghdr *nlh, | |||
2106 | cb->answer_flags = NLM_F_DUMP_FILTERED; | 2108 | cb->answer_flags = NLM_F_DUMP_FILTERED; |
2107 | } | 2109 | } |
2108 | 2110 | ||
2109 | err = nlmsg_parse_strict(nlh, sizeof(*rtm), tb, RTA_MAX, | 2111 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(*rtm), tb, RTA_MAX, |
2110 | rtm_mpls_policy, extack); | 2112 | rtm_mpls_policy, extack); |
2111 | if (err < 0) | 2113 | if (err < 0) |
2112 | return err; | 2114 | return err; |
2113 | 2115 | ||
@@ -2290,8 +2292,8 @@ static int mpls_valid_getroute_req(struct sk_buff *skb, | |||
2290 | } | 2292 | } |
2291 | 2293 | ||
2292 | if (!netlink_strict_get_check(skb)) | 2294 | if (!netlink_strict_get_check(skb)) |
2293 | return nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, | 2295 | return nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, |
2294 | rtm_mpls_policy, extack); | 2296 | rtm_mpls_policy, extack); |
2295 | 2297 | ||
2296 | rtm = nlmsg_data(nlh); | 2298 | rtm = nlmsg_data(nlh); |
2297 | if ((rtm->rtm_dst_len && rtm->rtm_dst_len != 20) || | 2299 | if ((rtm->rtm_dst_len && rtm->rtm_dst_len != 20) || |
@@ -2306,8 +2308,8 @@ static int mpls_valid_getroute_req(struct sk_buff *skb, | |||
2306 | return -EINVAL; | 2308 | return -EINVAL; |
2307 | } | 2309 | } |
2308 | 2310 | ||
2309 | err = nlmsg_parse_strict(nlh, sizeof(*rtm), tb, RTA_MAX, | 2311 | err = nlmsg_parse_deprecated_strict(nlh, sizeof(*rtm), tb, RTA_MAX, |
2310 | rtm_mpls_policy, extack); | 2312 | rtm_mpls_policy, extack); |
2311 | if (err) | 2313 | if (err) |
2312 | return err; | 2314 | return err; |
2313 | 2315 | ||
diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c index 2619c2fbea93..951b52d5835b 100644 --- a/net/mpls/mpls_iptunnel.c +++ b/net/mpls/mpls_iptunnel.c | |||
@@ -178,8 +178,8 @@ static int mpls_build_state(struct nlattr *nla, | |||
178 | u8 n_labels; | 178 | u8 n_labels; |
179 | int ret; | 179 | int ret; |
180 | 180 | ||
181 | ret = nla_parse_nested(tb, MPLS_IPTUNNEL_MAX, nla, | 181 | ret = nla_parse_nested_deprecated(tb, MPLS_IPTUNNEL_MAX, nla, |
182 | mpls_iptunnel_policy, extack); | 182 | mpls_iptunnel_policy, extack); |
183 | if (ret < 0) | 183 | if (ret < 0) |
184 | return ret; | 184 | return ret; |
185 | 185 | ||
diff --git a/net/ncsi/ncsi-netlink.c b/net/ncsi/ncsi-netlink.c index 672ed56b5ef0..37759c88ef02 100644 --- a/net/ncsi/ncsi-netlink.c +++ b/net/ncsi/ncsi-netlink.c | |||
@@ -220,8 +220,8 @@ static int ncsi_pkg_info_all_nl(struct sk_buff *skb, | |||
220 | void *hdr; | 220 | void *hdr; |
221 | int rc; | 221 | int rc; |
222 | 222 | ||
223 | rc = genlmsg_parse(cb->nlh, &ncsi_genl_family, attrs, NCSI_ATTR_MAX, | 223 | rc = genlmsg_parse_deprecated(cb->nlh, &ncsi_genl_family, attrs, NCSI_ATTR_MAX, |
224 | ncsi_genl_policy, NULL); | 224 | ncsi_genl_policy, NULL); |
225 | if (rc) | 225 | if (rc) |
226 | return rc; | 226 | return rc; |
227 | 227 | ||
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c index 45a257695bef..3f4a4936f63c 100644 --- a/net/netfilter/ipset/ip_set_core.c +++ b/net/netfilter/ipset/ip_set_core.c | |||
@@ -299,8 +299,7 @@ ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr) | |||
299 | 299 | ||
300 | if (unlikely(!flag_nested(nla))) | 300 | if (unlikely(!flag_nested(nla))) |
301 | return -IPSET_ERR_PROTOCOL; | 301 | return -IPSET_ERR_PROTOCOL; |
302 | if (nla_parse_nested(tb, IPSET_ATTR_IPADDR_MAX, nla, | 302 | if (nla_parse_nested_deprecated(tb, IPSET_ATTR_IPADDR_MAX, nla, ipaddr_policy, NULL)) |
303 | ipaddr_policy, NULL)) | ||
304 | return -IPSET_ERR_PROTOCOL; | 303 | return -IPSET_ERR_PROTOCOL; |
305 | if (unlikely(!ip_set_attr_netorder(tb, IPSET_ATTR_IPADDR_IPV4))) | 304 | if (unlikely(!ip_set_attr_netorder(tb, IPSET_ATTR_IPADDR_IPV4))) |
306 | return -IPSET_ERR_PROTOCOL; | 305 | return -IPSET_ERR_PROTOCOL; |
@@ -318,8 +317,7 @@ ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr) | |||
318 | if (unlikely(!flag_nested(nla))) | 317 | if (unlikely(!flag_nested(nla))) |
319 | return -IPSET_ERR_PROTOCOL; | 318 | return -IPSET_ERR_PROTOCOL; |
320 | 319 | ||
321 | if (nla_parse_nested(tb, IPSET_ATTR_IPADDR_MAX, nla, | 320 | if (nla_parse_nested_deprecated(tb, IPSET_ATTR_IPADDR_MAX, nla, ipaddr_policy, NULL)) |
322 | ipaddr_policy, NULL)) | ||
323 | return -IPSET_ERR_PROTOCOL; | 321 | return -IPSET_ERR_PROTOCOL; |
324 | if (unlikely(!ip_set_attr_netorder(tb, IPSET_ATTR_IPADDR_IPV6))) | 322 | if (unlikely(!ip_set_attr_netorder(tb, IPSET_ATTR_IPADDR_IPV6))) |
325 | return -IPSET_ERR_PROTOCOL; | 323 | return -IPSET_ERR_PROTOCOL; |
@@ -939,8 +937,7 @@ static int ip_set_create(struct net *net, struct sock *ctnl, | |||
939 | 937 | ||
940 | /* Without holding any locks, create private part. */ | 938 | /* Without holding any locks, create private part. */ |
941 | if (attr[IPSET_ATTR_DATA] && | 939 | if (attr[IPSET_ATTR_DATA] && |
942 | nla_parse_nested(tb, IPSET_ATTR_CREATE_MAX, attr[IPSET_ATTR_DATA], | 940 | nla_parse_nested_deprecated(tb, IPSET_ATTR_CREATE_MAX, attr[IPSET_ATTR_DATA], set->type->create_policy, NULL)) { |
943 | set->type->create_policy, NULL)) { | ||
944 | ret = -IPSET_ERR_PROTOCOL; | 941 | ret = -IPSET_ERR_PROTOCOL; |
945 | goto put_out; | 942 | goto put_out; |
946 | } | 943 | } |
@@ -1298,8 +1295,9 @@ dump_init(struct netlink_callback *cb, struct ip_set_net *inst) | |||
1298 | ip_set_id_t index; | 1295 | ip_set_id_t index; |
1299 | 1296 | ||
1300 | /* Second pass, so parser can't fail */ | 1297 | /* Second pass, so parser can't fail */ |
1301 | nla_parse(cda, IPSET_ATTR_CMD_MAX, attr, nlh->nlmsg_len - min_len, | 1298 | nla_parse_deprecated(cda, IPSET_ATTR_CMD_MAX, attr, |
1302 | ip_set_setname_policy, NULL); | 1299 | nlh->nlmsg_len - min_len, ip_set_setname_policy, |
1300 | NULL); | ||
1303 | 1301 | ||
1304 | cb->args[IPSET_CB_PROTO] = nla_get_u8(cda[IPSET_ATTR_PROTOCOL]); | 1302 | cb->args[IPSET_CB_PROTO] = nla_get_u8(cda[IPSET_ATTR_PROTOCOL]); |
1305 | if (cda[IPSET_ATTR_SETNAME]) { | 1303 | if (cda[IPSET_ATTR_SETNAME]) { |
@@ -1546,8 +1544,9 @@ call_ad(struct sock *ctnl, struct sk_buff *skb, struct ip_set *set, | |||
1546 | memcpy(&errmsg->msg, nlh, nlh->nlmsg_len); | 1544 | memcpy(&errmsg->msg, nlh, nlh->nlmsg_len); |
1547 | cmdattr = (void *)&errmsg->msg + min_len; | 1545 | cmdattr = (void *)&errmsg->msg + min_len; |
1548 | 1546 | ||
1549 | nla_parse(cda, IPSET_ATTR_CMD_MAX, cmdattr, | 1547 | nla_parse_deprecated(cda, IPSET_ATTR_CMD_MAX, cmdattr, |
1550 | nlh->nlmsg_len - min_len, ip_set_adt_policy, NULL); | 1548 | nlh->nlmsg_len - min_len, |
1549 | ip_set_adt_policy, NULL); | ||
1551 | 1550 | ||
1552 | errline = nla_data(cda[IPSET_ATTR_LINENO]); | 1551 | errline = nla_data(cda[IPSET_ATTR_LINENO]); |
1553 | 1552 | ||
@@ -1592,9 +1591,7 @@ static int ip_set_uadd(struct net *net, struct sock *ctnl, struct sk_buff *skb, | |||
1592 | 1591 | ||
1593 | use_lineno = !!attr[IPSET_ATTR_LINENO]; | 1592 | use_lineno = !!attr[IPSET_ATTR_LINENO]; |
1594 | if (attr[IPSET_ATTR_DATA]) { | 1593 | if (attr[IPSET_ATTR_DATA]) { |
1595 | if (nla_parse_nested(tb, IPSET_ATTR_ADT_MAX, | 1594 | if (nla_parse_nested_deprecated(tb, IPSET_ATTR_ADT_MAX, attr[IPSET_ATTR_DATA], set->type->adt_policy, NULL)) |
1596 | attr[IPSET_ATTR_DATA], | ||
1597 | set->type->adt_policy, NULL)) | ||
1598 | return -IPSET_ERR_PROTOCOL; | 1595 | return -IPSET_ERR_PROTOCOL; |
1599 | ret = call_ad(ctnl, skb, set, tb, IPSET_ADD, flags, | 1596 | ret = call_ad(ctnl, skb, set, tb, IPSET_ADD, flags, |
1600 | use_lineno); | 1597 | use_lineno); |
@@ -1605,8 +1602,7 @@ static int ip_set_uadd(struct net *net, struct sock *ctnl, struct sk_buff *skb, | |||
1605 | memset(tb, 0, sizeof(tb)); | 1602 | memset(tb, 0, sizeof(tb)); |
1606 | if (nla_type(nla) != IPSET_ATTR_DATA || | 1603 | if (nla_type(nla) != IPSET_ATTR_DATA || |
1607 | !flag_nested(nla) || | 1604 | !flag_nested(nla) || |
1608 | nla_parse_nested(tb, IPSET_ATTR_ADT_MAX, nla, | 1605 | nla_parse_nested_deprecated(tb, IPSET_ATTR_ADT_MAX, nla, set->type->adt_policy, NULL)) |
1609 | set->type->adt_policy, NULL)) | ||
1610 | return -IPSET_ERR_PROTOCOL; | 1606 | return -IPSET_ERR_PROTOCOL; |
1611 | ret = call_ad(ctnl, skb, set, tb, IPSET_ADD, | 1607 | ret = call_ad(ctnl, skb, set, tb, IPSET_ADD, |
1612 | flags, use_lineno); | 1608 | flags, use_lineno); |
@@ -1647,9 +1643,7 @@ static int ip_set_udel(struct net *net, struct sock *ctnl, struct sk_buff *skb, | |||
1647 | 1643 | ||
1648 | use_lineno = !!attr[IPSET_ATTR_LINENO]; | 1644 | use_lineno = !!attr[IPSET_ATTR_LINENO]; |
1649 | if (attr[IPSET_ATTR_DATA]) { | 1645 | if (attr[IPSET_ATTR_DATA]) { |
1650 | if (nla_parse_nested(tb, IPSET_ATTR_ADT_MAX, | 1646 | if (nla_parse_nested_deprecated(tb, IPSET_ATTR_ADT_MAX, attr[IPSET_ATTR_DATA], set->type->adt_policy, NULL)) |
1651 | attr[IPSET_ATTR_DATA], | ||
1652 | set->type->adt_policy, NULL)) | ||
1653 | return -IPSET_ERR_PROTOCOL; | 1647 | return -IPSET_ERR_PROTOCOL; |
1654 | ret = call_ad(ctnl, skb, set, tb, IPSET_DEL, flags, | 1648 | ret = call_ad(ctnl, skb, set, tb, IPSET_DEL, flags, |
1655 | use_lineno); | 1649 | use_lineno); |
@@ -1660,8 +1654,7 @@ static int ip_set_udel(struct net *net, struct sock *ctnl, struct sk_buff *skb, | |||
1660 | memset(tb, 0, sizeof(*tb)); | 1654 | memset(tb, 0, sizeof(*tb)); |
1661 | if (nla_type(nla) != IPSET_ATTR_DATA || | 1655 | if (nla_type(nla) != IPSET_ATTR_DATA || |
1662 | !flag_nested(nla) || | 1656 | !flag_nested(nla) || |
1663 | nla_parse_nested(tb, IPSET_ATTR_ADT_MAX, nla, | 1657 | nla_parse_nested_deprecated(tb, IPSET_ATTR_ADT_MAX, nla, set->type->adt_policy, NULL)) |
1664 | set->type->adt_policy, NULL)) | ||
1665 | return -IPSET_ERR_PROTOCOL; | 1658 | return -IPSET_ERR_PROTOCOL; |
1666 | ret = call_ad(ctnl, skb, set, tb, IPSET_DEL, | 1659 | ret = call_ad(ctnl, skb, set, tb, IPSET_DEL, |
1667 | flags, use_lineno); | 1660 | flags, use_lineno); |
@@ -1692,8 +1685,7 @@ static int ip_set_utest(struct net *net, struct sock *ctnl, struct sk_buff *skb, | |||
1692 | if (!set) | 1685 | if (!set) |
1693 | return -ENOENT; | 1686 | return -ENOENT; |
1694 | 1687 | ||
1695 | if (nla_parse_nested(tb, IPSET_ATTR_ADT_MAX, attr[IPSET_ATTR_DATA], | 1688 | if (nla_parse_nested_deprecated(tb, IPSET_ATTR_ADT_MAX, attr[IPSET_ATTR_DATA], set->type->adt_policy, NULL)) |
1696 | set->type->adt_policy, NULL)) | ||
1697 | return -IPSET_ERR_PROTOCOL; | 1689 | return -IPSET_ERR_PROTOCOL; |
1698 | 1690 | ||
1699 | rcu_read_lock_bh(); | 1691 | rcu_read_lock_bh(); |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 39892e5d38a2..24bb1a7b590c 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -3116,8 +3116,7 @@ static int ip_vs_genl_parse_service(struct netns_ipvs *ipvs, | |||
3116 | 3116 | ||
3117 | /* Parse mandatory identifying service fields first */ | 3117 | /* Parse mandatory identifying service fields first */ |
3118 | if (nla == NULL || | 3118 | if (nla == NULL || |
3119 | nla_parse_nested(attrs, IPVS_SVC_ATTR_MAX, nla, | 3119 | nla_parse_nested_deprecated(attrs, IPVS_SVC_ATTR_MAX, nla, ip_vs_svc_policy, NULL)) |
3120 | ip_vs_svc_policy, NULL)) | ||
3121 | return -EINVAL; | 3120 | return -EINVAL; |
3122 | 3121 | ||
3123 | nla_af = attrs[IPVS_SVC_ATTR_AF]; | 3122 | nla_af = attrs[IPVS_SVC_ATTR_AF]; |
@@ -3279,8 +3278,7 @@ static int ip_vs_genl_dump_dests(struct sk_buff *skb, | |||
3279 | mutex_lock(&__ip_vs_mutex); | 3278 | mutex_lock(&__ip_vs_mutex); |
3280 | 3279 | ||
3281 | /* Try to find the service for which to dump destinations */ | 3280 | /* Try to find the service for which to dump destinations */ |
3282 | if (nlmsg_parse(cb->nlh, GENL_HDRLEN, attrs, IPVS_CMD_ATTR_MAX, | 3281 | if (nlmsg_parse_deprecated(cb->nlh, GENL_HDRLEN, attrs, IPVS_CMD_ATTR_MAX, ip_vs_cmd_policy, cb->extack)) |
3283 | ip_vs_cmd_policy, cb->extack)) | ||
3284 | goto out_err; | 3282 | goto out_err; |
3285 | 3283 | ||
3286 | 3284 | ||
@@ -3316,8 +3314,7 @@ static int ip_vs_genl_parse_dest(struct ip_vs_dest_user_kern *udest, | |||
3316 | 3314 | ||
3317 | /* Parse mandatory identifying destination fields first */ | 3315 | /* Parse mandatory identifying destination fields first */ |
3318 | if (nla == NULL || | 3316 | if (nla == NULL || |
3319 | nla_parse_nested(attrs, IPVS_DEST_ATTR_MAX, nla, | 3317 | nla_parse_nested_deprecated(attrs, IPVS_DEST_ATTR_MAX, nla, ip_vs_dest_policy, NULL)) |
3320 | ip_vs_dest_policy, NULL)) | ||
3321 | return -EINVAL; | 3318 | return -EINVAL; |
3322 | 3319 | ||
3323 | nla_addr = attrs[IPVS_DEST_ATTR_ADDR]; | 3320 | nla_addr = attrs[IPVS_DEST_ATTR_ADDR]; |
@@ -3561,9 +3558,7 @@ static int ip_vs_genl_set_daemon(struct sk_buff *skb, struct genl_info *info) | |||
3561 | struct nlattr *daemon_attrs[IPVS_DAEMON_ATTR_MAX + 1]; | 3558 | struct nlattr *daemon_attrs[IPVS_DAEMON_ATTR_MAX + 1]; |
3562 | 3559 | ||
3563 | if (!info->attrs[IPVS_CMD_ATTR_DAEMON] || | 3560 | if (!info->attrs[IPVS_CMD_ATTR_DAEMON] || |
3564 | nla_parse_nested(daemon_attrs, IPVS_DAEMON_ATTR_MAX, | 3561 | nla_parse_nested_deprecated(daemon_attrs, IPVS_DAEMON_ATTR_MAX, info->attrs[IPVS_CMD_ATTR_DAEMON], ip_vs_daemon_policy, info->extack)) |
3565 | info->attrs[IPVS_CMD_ATTR_DAEMON], | ||
3566 | ip_vs_daemon_policy, info->extack)) | ||
3567 | goto out; | 3562 | goto out; |
3568 | 3563 | ||
3569 | if (cmd == IPVS_CMD_NEW_DAEMON) | 3564 | if (cmd == IPVS_CMD_NEW_DAEMON) |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 148b99a15b21..8dcc064d518d 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -1020,12 +1020,12 @@ static int ctnetlink_parse_tuple_ip(struct nlattr *attr, | |||
1020 | struct nlattr *tb[CTA_IP_MAX+1]; | 1020 | struct nlattr *tb[CTA_IP_MAX+1]; |
1021 | int ret = 0; | 1021 | int ret = 0; |
1022 | 1022 | ||
1023 | ret = nla_parse_nested(tb, CTA_IP_MAX, attr, NULL, NULL); | 1023 | ret = nla_parse_nested_deprecated(tb, CTA_IP_MAX, attr, NULL, NULL); |
1024 | if (ret < 0) | 1024 | if (ret < 0) |
1025 | return ret; | 1025 | return ret; |
1026 | 1026 | ||
1027 | ret = nla_validate_nested(attr, CTA_IP_MAX, | 1027 | ret = nla_validate_nested_deprecated(attr, CTA_IP_MAX, |
1028 | cta_ip_nla_policy, NULL); | 1028 | cta_ip_nla_policy, NULL); |
1029 | if (ret) | 1029 | if (ret) |
1030 | return ret; | 1030 | return ret; |
1031 | 1031 | ||
@@ -1052,8 +1052,8 @@ static int ctnetlink_parse_tuple_proto(struct nlattr *attr, | |||
1052 | struct nlattr *tb[CTA_PROTO_MAX+1]; | 1052 | struct nlattr *tb[CTA_PROTO_MAX+1]; |
1053 | int ret = 0; | 1053 | int ret = 0; |
1054 | 1054 | ||
1055 | ret = nla_parse_nested(tb, CTA_PROTO_MAX, attr, proto_nla_policy, | 1055 | ret = nla_parse_nested_deprecated(tb, CTA_PROTO_MAX, attr, |
1056 | NULL); | 1056 | proto_nla_policy, NULL); |
1057 | if (ret < 0) | 1057 | if (ret < 0) |
1058 | return ret; | 1058 | return ret; |
1059 | 1059 | ||
@@ -1065,8 +1065,9 @@ static int ctnetlink_parse_tuple_proto(struct nlattr *attr, | |||
1065 | l4proto = nf_ct_l4proto_find(tuple->dst.protonum); | 1065 | l4proto = nf_ct_l4proto_find(tuple->dst.protonum); |
1066 | 1066 | ||
1067 | if (likely(l4proto->nlattr_to_tuple)) { | 1067 | if (likely(l4proto->nlattr_to_tuple)) { |
1068 | ret = nla_validate_nested(attr, CTA_PROTO_MAX, | 1068 | ret = nla_validate_nested_deprecated(attr, CTA_PROTO_MAX, |
1069 | l4proto->nla_policy, NULL); | 1069 | l4proto->nla_policy, |
1070 | NULL); | ||
1070 | if (ret == 0) | 1071 | if (ret == 0) |
1071 | ret = l4proto->nlattr_to_tuple(tb, tuple); | 1072 | ret = l4proto->nlattr_to_tuple(tb, tuple); |
1072 | } | 1073 | } |
@@ -1129,8 +1130,8 @@ ctnetlink_parse_tuple(const struct nlattr * const cda[], | |||
1129 | 1130 | ||
1130 | memset(tuple, 0, sizeof(*tuple)); | 1131 | memset(tuple, 0, sizeof(*tuple)); |
1131 | 1132 | ||
1132 | err = nla_parse_nested(tb, CTA_TUPLE_MAX, cda[type], tuple_nla_policy, | 1133 | err = nla_parse_nested_deprecated(tb, CTA_TUPLE_MAX, cda[type], |
1133 | NULL); | 1134 | tuple_nla_policy, NULL); |
1134 | if (err < 0) | 1135 | if (err < 0) |
1135 | return err; | 1136 | return err; |
1136 | 1137 | ||
@@ -1180,7 +1181,8 @@ static int ctnetlink_parse_help(const struct nlattr *attr, char **helper_name, | |||
1180 | int err; | 1181 | int err; |
1181 | struct nlattr *tb[CTA_HELP_MAX+1]; | 1182 | struct nlattr *tb[CTA_HELP_MAX+1]; |
1182 | 1183 | ||
1183 | err = nla_parse_nested(tb, CTA_HELP_MAX, attr, help_nla_policy, NULL); | 1184 | err = nla_parse_nested_deprecated(tb, CTA_HELP_MAX, attr, |
1185 | help_nla_policy, NULL); | ||
1184 | if (err < 0) | 1186 | if (err < 0) |
1185 | return err; | 1187 | return err; |
1186 | 1188 | ||
@@ -1721,8 +1723,8 @@ static int ctnetlink_change_protoinfo(struct nf_conn *ct, | |||
1721 | struct nlattr *tb[CTA_PROTOINFO_MAX+1]; | 1723 | struct nlattr *tb[CTA_PROTOINFO_MAX+1]; |
1722 | int err = 0; | 1724 | int err = 0; |
1723 | 1725 | ||
1724 | err = nla_parse_nested(tb, CTA_PROTOINFO_MAX, attr, protoinfo_policy, | 1726 | err = nla_parse_nested_deprecated(tb, CTA_PROTOINFO_MAX, attr, |
1725 | NULL); | 1727 | protoinfo_policy, NULL); |
1726 | if (err < 0) | 1728 | if (err < 0) |
1727 | return err; | 1729 | return err; |
1728 | 1730 | ||
@@ -1745,7 +1747,8 @@ static int change_seq_adj(struct nf_ct_seqadj *seq, | |||
1745 | int err; | 1747 | int err; |
1746 | struct nlattr *cda[CTA_SEQADJ_MAX+1]; | 1748 | struct nlattr *cda[CTA_SEQADJ_MAX+1]; |
1747 | 1749 | ||
1748 | err = nla_parse_nested(cda, CTA_SEQADJ_MAX, attr, seqadj_policy, NULL); | 1750 | err = nla_parse_nested_deprecated(cda, CTA_SEQADJ_MAX, attr, |
1751 | seqadj_policy, NULL); | ||
1749 | if (err < 0) | 1752 | if (err < 0) |
1750 | return err; | 1753 | return err; |
1751 | 1754 | ||
@@ -1822,8 +1825,9 @@ static int ctnetlink_change_synproxy(struct nf_conn *ct, | |||
1822 | if (!synproxy) | 1825 | if (!synproxy) |
1823 | return 0; | 1826 | return 0; |
1824 | 1827 | ||
1825 | err = nla_parse_nested(tb, CTA_SYNPROXY_MAX, cda[CTA_SYNPROXY], | 1828 | err = nla_parse_nested_deprecated(tb, CTA_SYNPROXY_MAX, |
1826 | synproxy_policy, NULL); | 1829 | cda[CTA_SYNPROXY], synproxy_policy, |
1830 | NULL); | ||
1827 | if (err < 0) | 1831 | if (err < 0) |
1828 | return err; | 1832 | return err; |
1829 | 1833 | ||
@@ -2553,7 +2557,8 @@ ctnetlink_glue_parse(const struct nlattr *attr, struct nf_conn *ct) | |||
2553 | struct nlattr *cda[CTA_MAX+1]; | 2557 | struct nlattr *cda[CTA_MAX+1]; |
2554 | int ret; | 2558 | int ret; |
2555 | 2559 | ||
2556 | ret = nla_parse_nested(cda, CTA_MAX, attr, ct_nla_policy, NULL); | 2560 | ret = nla_parse_nested_deprecated(cda, CTA_MAX, attr, ct_nla_policy, |
2561 | NULL); | ||
2557 | if (ret < 0) | 2562 | if (ret < 0) |
2558 | return ret; | 2563 | return ret; |
2559 | 2564 | ||
@@ -2586,8 +2591,8 @@ ctnetlink_glue_attach_expect(const struct nlattr *attr, struct nf_conn *ct, | |||
2586 | struct nf_conntrack_expect *exp; | 2591 | struct nf_conntrack_expect *exp; |
2587 | int err; | 2592 | int err; |
2588 | 2593 | ||
2589 | err = nla_parse_nested(cda, CTA_EXPECT_MAX, attr, exp_nla_policy, | 2594 | err = nla_parse_nested_deprecated(cda, CTA_EXPECT_MAX, attr, |
2590 | NULL); | 2595 | exp_nla_policy, NULL); |
2591 | if (err < 0) | 2596 | if (err < 0) |
2592 | return err; | 2597 | return err; |
2593 | 2598 | ||
@@ -3209,8 +3214,8 @@ ctnetlink_parse_expect_nat(const struct nlattr *attr, | |||
3209 | struct nf_conntrack_tuple nat_tuple = {}; | 3214 | struct nf_conntrack_tuple nat_tuple = {}; |
3210 | int err; | 3215 | int err; |
3211 | 3216 | ||
3212 | err = nla_parse_nested(tb, CTA_EXPECT_NAT_MAX, attr, | 3217 | err = nla_parse_nested_deprecated(tb, CTA_EXPECT_NAT_MAX, attr, |
3213 | exp_nat_nla_policy, NULL); | 3218 | exp_nat_nla_policy, NULL); |
3214 | if (err < 0) | 3219 | if (err < 0) |
3215 | return err; | 3220 | return err; |
3216 | 3221 | ||
diff --git a/net/netfilter/nf_conntrack_proto_dccp.c b/net/netfilter/nf_conntrack_proto_dccp.c index a4deddebec0a..7491aa4c3566 100644 --- a/net/netfilter/nf_conntrack_proto_dccp.c +++ b/net/netfilter/nf_conntrack_proto_dccp.c | |||
@@ -639,8 +639,8 @@ static int nlattr_to_dccp(struct nlattr *cda[], struct nf_conn *ct) | |||
639 | if (!attr) | 639 | if (!attr) |
640 | return 0; | 640 | return 0; |
641 | 641 | ||
642 | err = nla_parse_nested(tb, CTA_PROTOINFO_DCCP_MAX, attr, | 642 | err = nla_parse_nested_deprecated(tb, CTA_PROTOINFO_DCCP_MAX, attr, |
643 | dccp_nla_policy, NULL); | 643 | dccp_nla_policy, NULL); |
644 | if (err < 0) | 644 | if (err < 0) |
645 | return err; | 645 | return err; |
646 | 646 | ||
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c index 8cf36b684400..5b8dde266412 100644 --- a/net/netfilter/nf_conntrack_proto_sctp.c +++ b/net/netfilter/nf_conntrack_proto_sctp.c | |||
@@ -563,8 +563,8 @@ static int nlattr_to_sctp(struct nlattr *cda[], struct nf_conn *ct) | |||
563 | if (!attr) | 563 | if (!attr) |
564 | return 0; | 564 | return 0; |
565 | 565 | ||
566 | err = nla_parse_nested(tb, CTA_PROTOINFO_SCTP_MAX, attr, | 566 | err = nla_parse_nested_deprecated(tb, CTA_PROTOINFO_SCTP_MAX, attr, |
567 | sctp_nla_policy, NULL); | 567 | sctp_nla_policy, NULL); |
568 | if (err < 0) | 568 | if (err < 0) |
569 | return err; | 569 | return err; |
570 | 570 | ||
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index ec6c3618333d..7ba01d8ee165 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
@@ -1248,8 +1248,8 @@ static int nlattr_to_tcp(struct nlattr *cda[], struct nf_conn *ct) | |||
1248 | if (!pattr) | 1248 | if (!pattr) |
1249 | return 0; | 1249 | return 0; |
1250 | 1250 | ||
1251 | err = nla_parse_nested(tb, CTA_PROTOINFO_TCP_MAX, pattr, | 1251 | err = nla_parse_nested_deprecated(tb, CTA_PROTOINFO_TCP_MAX, pattr, |
1252 | tcp_nla_policy, NULL); | 1252 | tcp_nla_policy, NULL); |
1253 | if (err < 0) | 1253 | if (err < 0) |
1254 | return err; | 1254 | return err; |
1255 | 1255 | ||
diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c index 715e3d4d761b..cd94481e6c07 100644 --- a/net/netfilter/nf_nat_core.c +++ b/net/netfilter/nf_nat_core.c | |||
@@ -890,8 +890,8 @@ static int nfnetlink_parse_nat_proto(struct nlattr *attr, | |||
890 | struct nlattr *tb[CTA_PROTONAT_MAX+1]; | 890 | struct nlattr *tb[CTA_PROTONAT_MAX+1]; |
891 | int err; | 891 | int err; |
892 | 892 | ||
893 | err = nla_parse_nested(tb, CTA_PROTONAT_MAX, attr, | 893 | err = nla_parse_nested_deprecated(tb, CTA_PROTONAT_MAX, attr, |
894 | protonat_nla_policy, NULL); | 894 | protonat_nla_policy, NULL); |
895 | if (err < 0) | 895 | if (err < 0) |
896 | return err; | 896 | return err; |
897 | 897 | ||
@@ -949,7 +949,8 @@ nfnetlink_parse_nat(const struct nlattr *nat, | |||
949 | 949 | ||
950 | memset(range, 0, sizeof(*range)); | 950 | memset(range, 0, sizeof(*range)); |
951 | 951 | ||
952 | err = nla_parse_nested(tb, CTA_NAT_MAX, nat, nat_nla_policy, NULL); | 952 | err = nla_parse_nested_deprecated(tb, CTA_NAT_MAX, nat, |
953 | nat_nla_policy, NULL); | ||
953 | if (err < 0) | 954 | if (err < 0) |
954 | return err; | 955 | return err; |
955 | 956 | ||
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 2b79c250ecb4..d98416e83d4e 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
@@ -1420,8 +1420,8 @@ static struct nft_stats __percpu *nft_stats_alloc(const struct nlattr *attr) | |||
1420 | struct nft_stats *stats; | 1420 | struct nft_stats *stats; |
1421 | int err; | 1421 | int err; |
1422 | 1422 | ||
1423 | err = nla_parse_nested(tb, NFTA_COUNTER_MAX, attr, nft_counter_policy, | 1423 | err = nla_parse_nested_deprecated(tb, NFTA_COUNTER_MAX, attr, |
1424 | NULL); | 1424 | nft_counter_policy, NULL); |
1425 | if (err < 0) | 1425 | if (err < 0) |
1426 | return ERR_PTR(err); | 1426 | return ERR_PTR(err); |
1427 | 1427 | ||
@@ -1525,8 +1525,9 @@ static int nft_chain_parse_hook(struct net *net, | |||
1525 | lockdep_assert_held(&net->nft.commit_mutex); | 1525 | lockdep_assert_held(&net->nft.commit_mutex); |
1526 | lockdep_nfnl_nft_mutex_not_held(); | 1526 | lockdep_nfnl_nft_mutex_not_held(); |
1527 | 1527 | ||
1528 | err = nla_parse_nested(ha, NFTA_HOOK_MAX, nla[NFTA_CHAIN_HOOK], | 1528 | err = nla_parse_nested_deprecated(ha, NFTA_HOOK_MAX, |
1529 | nft_hook_policy, NULL); | 1529 | nla[NFTA_CHAIN_HOOK], |
1530 | nft_hook_policy, NULL); | ||
1530 | if (err < 0) | 1531 | if (err < 0) |
1531 | return err; | 1532 | return err; |
1532 | 1533 | ||
@@ -2105,7 +2106,8 @@ static int nf_tables_expr_parse(const struct nft_ctx *ctx, | |||
2105 | struct nlattr *tb[NFTA_EXPR_MAX + 1]; | 2106 | struct nlattr *tb[NFTA_EXPR_MAX + 1]; |
2106 | int err; | 2107 | int err; |
2107 | 2108 | ||
2108 | err = nla_parse_nested(tb, NFTA_EXPR_MAX, nla, nft_expr_policy, NULL); | 2109 | err = nla_parse_nested_deprecated(tb, NFTA_EXPR_MAX, nla, |
2110 | nft_expr_policy, NULL); | ||
2109 | if (err < 0) | 2111 | if (err < 0) |
2110 | return err; | 2112 | return err; |
2111 | 2113 | ||
@@ -2114,8 +2116,9 @@ static int nf_tables_expr_parse(const struct nft_ctx *ctx, | |||
2114 | return PTR_ERR(type); | 2116 | return PTR_ERR(type); |
2115 | 2117 | ||
2116 | if (tb[NFTA_EXPR_DATA]) { | 2118 | if (tb[NFTA_EXPR_DATA]) { |
2117 | err = nla_parse_nested(info->tb, type->maxattr, | 2119 | err = nla_parse_nested_deprecated(info->tb, type->maxattr, |
2118 | tb[NFTA_EXPR_DATA], type->policy, NULL); | 2120 | tb[NFTA_EXPR_DATA], |
2121 | type->policy, NULL); | ||
2119 | if (err < 0) | 2122 | if (err < 0) |
2120 | goto err1; | 2123 | goto err1; |
2121 | } else | 2124 | } else |
@@ -3443,8 +3446,8 @@ static int nf_tables_set_desc_parse(struct nft_set_desc *desc, | |||
3443 | struct nlattr *da[NFTA_SET_DESC_MAX + 1]; | 3446 | struct nlattr *da[NFTA_SET_DESC_MAX + 1]; |
3444 | int err; | 3447 | int err; |
3445 | 3448 | ||
3446 | err = nla_parse_nested(da, NFTA_SET_DESC_MAX, nla, | 3449 | err = nla_parse_nested_deprecated(da, NFTA_SET_DESC_MAX, nla, |
3447 | nft_set_desc_policy, NULL); | 3450 | nft_set_desc_policy, NULL); |
3448 | if (err < 0) | 3451 | if (err < 0) |
3449 | return err; | 3452 | return err; |
3450 | 3453 | ||
@@ -4170,8 +4173,8 @@ static int nft_get_set_elem(struct nft_ctx *ctx, struct nft_set *set, | |||
4170 | void *priv; | 4173 | void *priv; |
4171 | int err; | 4174 | int err; |
4172 | 4175 | ||
4173 | err = nla_parse_nested(nla, NFTA_SET_ELEM_MAX, attr, | 4176 | err = nla_parse_nested_deprecated(nla, NFTA_SET_ELEM_MAX, attr, |
4174 | nft_set_elem_policy, NULL); | 4177 | nft_set_elem_policy, NULL); |
4175 | if (err < 0) | 4178 | if (err < 0) |
4176 | return err; | 4179 | return err; |
4177 | 4180 | ||
@@ -4402,8 +4405,8 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set, | |||
4402 | u8 ulen; | 4405 | u8 ulen; |
4403 | int err; | 4406 | int err; |
4404 | 4407 | ||
4405 | err = nla_parse_nested(nla, NFTA_SET_ELEM_MAX, attr, | 4408 | err = nla_parse_nested_deprecated(nla, NFTA_SET_ELEM_MAX, attr, |
4406 | nft_set_elem_policy, NULL); | 4409 | nft_set_elem_policy, NULL); |
4407 | if (err < 0) | 4410 | if (err < 0) |
4408 | return err; | 4411 | return err; |
4409 | 4412 | ||
@@ -4696,8 +4699,8 @@ static int nft_del_setelem(struct nft_ctx *ctx, struct nft_set *set, | |||
4696 | void *priv; | 4699 | void *priv; |
4697 | int err; | 4700 | int err; |
4698 | 4701 | ||
4699 | err = nla_parse_nested(nla, NFTA_SET_ELEM_MAX, attr, | 4702 | err = nla_parse_nested_deprecated(nla, NFTA_SET_ELEM_MAX, attr, |
4700 | nft_set_elem_policy, NULL); | 4703 | nft_set_elem_policy, NULL); |
4701 | if (err < 0) | 4704 | if (err < 0) |
4702 | goto err1; | 4705 | goto err1; |
4703 | 4706 | ||
@@ -4971,8 +4974,8 @@ static struct nft_object *nft_obj_init(const struct nft_ctx *ctx, | |||
4971 | goto err1; | 4974 | goto err1; |
4972 | 4975 | ||
4973 | if (attr) { | 4976 | if (attr) { |
4974 | err = nla_parse_nested(tb, type->maxattr, attr, type->policy, | 4977 | err = nla_parse_nested_deprecated(tb, type->maxattr, attr, |
4975 | NULL); | 4978 | type->policy, NULL); |
4976 | if (err < 0) | 4979 | if (err < 0) |
4977 | goto err2; | 4980 | goto err2; |
4978 | } else { | 4981 | } else { |
@@ -5548,8 +5551,8 @@ static int nf_tables_flowtable_parse_hook(const struct nft_ctx *ctx, | |||
5548 | int hooknum, priority; | 5551 | int hooknum, priority; |
5549 | int err, n = 0, i; | 5552 | int err, n = 0, i; |
5550 | 5553 | ||
5551 | err = nla_parse_nested(tb, NFTA_FLOWTABLE_HOOK_MAX, attr, | 5554 | err = nla_parse_nested_deprecated(tb, NFTA_FLOWTABLE_HOOK_MAX, attr, |
5552 | nft_flowtable_hook_policy, NULL); | 5555 | nft_flowtable_hook_policy, NULL); |
5553 | if (err < 0) | 5556 | if (err < 0) |
5554 | return err; | 5557 | return err; |
5555 | 5558 | ||
@@ -7206,8 +7209,8 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data, | |||
7206 | struct nft_chain *chain; | 7209 | struct nft_chain *chain; |
7207 | int err; | 7210 | int err; |
7208 | 7211 | ||
7209 | err = nla_parse_nested(tb, NFTA_VERDICT_MAX, nla, nft_verdict_policy, | 7212 | err = nla_parse_nested_deprecated(tb, NFTA_VERDICT_MAX, nla, |
7210 | NULL); | 7213 | nft_verdict_policy, NULL); |
7211 | if (err < 0) | 7214 | if (err < 0) |
7212 | return err; | 7215 | return err; |
7213 | 7216 | ||
@@ -7337,7 +7340,8 @@ int nft_data_init(const struct nft_ctx *ctx, | |||
7337 | struct nlattr *tb[NFTA_DATA_MAX + 1]; | 7340 | struct nlattr *tb[NFTA_DATA_MAX + 1]; |
7338 | int err; | 7341 | int err; |
7339 | 7342 | ||
7340 | err = nla_parse_nested(tb, NFTA_DATA_MAX, nla, nft_data_policy, NULL); | 7343 | err = nla_parse_nested_deprecated(tb, NFTA_DATA_MAX, nla, |
7344 | nft_data_policy, NULL); | ||
7341 | if (err < 0) | 7345 | if (err < 0) |
7342 | return err; | 7346 | return err; |
7343 | 7347 | ||
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index 916913454624..92077d459109 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
@@ -206,8 +206,9 @@ replay: | |||
206 | return -ENOMEM; | 206 | return -ENOMEM; |
207 | } | 207 | } |
208 | 208 | ||
209 | err = nla_parse(cda, ss->cb[cb_id].attr_count, attr, attrlen, | 209 | err = nla_parse_deprecated(cda, ss->cb[cb_id].attr_count, |
210 | ss->cb[cb_id].policy, extack); | 210 | attr, attrlen, |
211 | ss->cb[cb_id].policy, extack); | ||
211 | if (err < 0) { | 212 | if (err < 0) { |
212 | rcu_read_unlock(); | 213 | rcu_read_unlock(); |
213 | return err; | 214 | return err; |
@@ -421,8 +422,10 @@ replay: | |||
421 | goto ack; | 422 | goto ack; |
422 | } | 423 | } |
423 | 424 | ||
424 | err = nla_parse(cda, ss->cb[cb_id].attr_count, attr, | 425 | err = nla_parse_deprecated(cda, |
425 | attrlen, ss->cb[cb_id].policy, NULL); | 426 | ss->cb[cb_id].attr_count, |
427 | attr, attrlen, | ||
428 | ss->cb[cb_id].policy, NULL); | ||
426 | if (err < 0) | 429 | if (err < 0) |
427 | goto ack; | 430 | goto ack; |
428 | 431 | ||
@@ -520,8 +523,8 @@ static void nfnetlink_rcv_skb_batch(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
520 | if (skb->len < NLMSG_HDRLEN + sizeof(struct nfgenmsg)) | 523 | if (skb->len < NLMSG_HDRLEN + sizeof(struct nfgenmsg)) |
521 | return; | 524 | return; |
522 | 525 | ||
523 | err = nla_parse(cda, NFNL_BATCH_MAX, attr, attrlen, nfnl_batch_policy, | 526 | err = nla_parse_deprecated(cda, NFNL_BATCH_MAX, attr, attrlen, |
524 | NULL); | 527 | nfnl_batch_policy, NULL); |
525 | if (err < 0) { | 528 | if (err < 0) { |
526 | netlink_ack(skb, nlh, err, NULL); | 529 | netlink_ack(skb, nlh, err, NULL); |
527 | return; | 530 | return; |
diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c index 8fa8bf7c48e6..02c877432d71 100644 --- a/net/netfilter/nfnetlink_acct.c +++ b/net/netfilter/nfnetlink_acct.c | |||
@@ -248,8 +248,8 @@ static int nfnl_acct_start(struct netlink_callback *cb) | |||
248 | if (!attr) | 248 | if (!attr) |
249 | return 0; | 249 | return 0; |
250 | 250 | ||
251 | err = nla_parse_nested(tb, NFACCT_FILTER_MAX, attr, filter_policy, | 251 | err = nla_parse_nested_deprecated(tb, NFACCT_FILTER_MAX, attr, |
252 | NULL); | 252 | filter_policy, NULL); |
253 | if (err < 0) | 253 | if (err < 0) |
254 | return err; | 254 | return err; |
255 | 255 | ||
diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c index 74c9794d28d6..17eb473a626b 100644 --- a/net/netfilter/nfnetlink_cthelper.c +++ b/net/netfilter/nfnetlink_cthelper.c | |||
@@ -78,8 +78,8 @@ nfnl_cthelper_parse_tuple(struct nf_conntrack_tuple *tuple, | |||
78 | int err; | 78 | int err; |
79 | struct nlattr *tb[NFCTH_TUPLE_MAX+1]; | 79 | struct nlattr *tb[NFCTH_TUPLE_MAX+1]; |
80 | 80 | ||
81 | err = nla_parse_nested(tb, NFCTH_TUPLE_MAX, attr, | 81 | err = nla_parse_nested_deprecated(tb, NFCTH_TUPLE_MAX, attr, |
82 | nfnl_cthelper_tuple_pol, NULL); | 82 | nfnl_cthelper_tuple_pol, NULL); |
83 | if (err < 0) | 83 | if (err < 0) |
84 | return err; | 84 | return err; |
85 | 85 | ||
@@ -139,8 +139,8 @@ nfnl_cthelper_expect_policy(struct nf_conntrack_expect_policy *expect_policy, | |||
139 | int err; | 139 | int err; |
140 | struct nlattr *tb[NFCTH_POLICY_MAX+1]; | 140 | struct nlattr *tb[NFCTH_POLICY_MAX+1]; |
141 | 141 | ||
142 | err = nla_parse_nested(tb, NFCTH_POLICY_MAX, attr, | 142 | err = nla_parse_nested_deprecated(tb, NFCTH_POLICY_MAX, attr, |
143 | nfnl_cthelper_expect_pol, NULL); | 143 | nfnl_cthelper_expect_pol, NULL); |
144 | if (err < 0) | 144 | if (err < 0) |
145 | return err; | 145 | return err; |
146 | 146 | ||
@@ -176,8 +176,9 @@ nfnl_cthelper_parse_expect_policy(struct nf_conntrack_helper *helper, | |||
176 | struct nlattr *tb[NFCTH_POLICY_SET_MAX+1]; | 176 | struct nlattr *tb[NFCTH_POLICY_SET_MAX+1]; |
177 | unsigned int class_max; | 177 | unsigned int class_max; |
178 | 178 | ||
179 | ret = nla_parse_nested(tb, NFCTH_POLICY_SET_MAX, attr, | 179 | ret = nla_parse_nested_deprecated(tb, NFCTH_POLICY_SET_MAX, attr, |
180 | nfnl_cthelper_expect_policy_set, NULL); | 180 | nfnl_cthelper_expect_policy_set, |
181 | NULL); | ||
181 | if (ret < 0) | 182 | if (ret < 0) |
182 | return ret; | 183 | return ret; |
183 | 184 | ||
@@ -289,8 +290,8 @@ nfnl_cthelper_update_policy_one(const struct nf_conntrack_expect_policy *policy, | |||
289 | struct nlattr *tb[NFCTH_POLICY_MAX + 1]; | 290 | struct nlattr *tb[NFCTH_POLICY_MAX + 1]; |
290 | int err; | 291 | int err; |
291 | 292 | ||
292 | err = nla_parse_nested(tb, NFCTH_POLICY_MAX, attr, | 293 | err = nla_parse_nested_deprecated(tb, NFCTH_POLICY_MAX, attr, |
293 | nfnl_cthelper_expect_pol, NULL); | 294 | nfnl_cthelper_expect_pol, NULL); |
294 | if (err < 0) | 295 | if (err < 0) |
295 | return err; | 296 | return err; |
296 | 297 | ||
@@ -361,8 +362,9 @@ static int nfnl_cthelper_update_policy(struct nf_conntrack_helper *helper, | |||
361 | unsigned int class_max; | 362 | unsigned int class_max; |
362 | int err; | 363 | int err; |
363 | 364 | ||
364 | err = nla_parse_nested(tb, NFCTH_POLICY_SET_MAX, attr, | 365 | err = nla_parse_nested_deprecated(tb, NFCTH_POLICY_SET_MAX, attr, |
365 | nfnl_cthelper_expect_policy_set, NULL); | 366 | nfnl_cthelper_expect_policy_set, |
367 | NULL); | ||
366 | if (err < 0) | 368 | if (err < 0) |
367 | return err; | 369 | return err; |
368 | 370 | ||
diff --git a/net/netfilter/nfnetlink_cttimeout.c b/net/netfilter/nfnetlink_cttimeout.c index 572cb42e1ee1..427b411c5739 100644 --- a/net/netfilter/nfnetlink_cttimeout.c +++ b/net/netfilter/nfnetlink_cttimeout.c | |||
@@ -59,8 +59,11 @@ ctnl_timeout_parse_policy(void *timeout, | |||
59 | if (!tb) | 59 | if (!tb) |
60 | return -ENOMEM; | 60 | return -ENOMEM; |
61 | 61 | ||
62 | ret = nla_parse_nested(tb, l4proto->ctnl_timeout.nlattr_max, attr, | 62 | ret = nla_parse_nested_deprecated(tb, |
63 | l4proto->ctnl_timeout.nla_policy, NULL); | 63 | l4proto->ctnl_timeout.nlattr_max, |
64 | attr, | ||
65 | l4proto->ctnl_timeout.nla_policy, | ||
66 | NULL); | ||
64 | if (ret < 0) | 67 | if (ret < 0) |
65 | goto err; | 68 | goto err; |
66 | 69 | ||
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index be7d53943e2d..27dac47b29c2 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
@@ -1139,8 +1139,9 @@ static int nfqa_parse_bridge(struct nf_queue_entry *entry, | |||
1139 | struct nlattr *tb[NFQA_VLAN_MAX + 1]; | 1139 | struct nlattr *tb[NFQA_VLAN_MAX + 1]; |
1140 | int err; | 1140 | int err; |
1141 | 1141 | ||
1142 | err = nla_parse_nested(tb, NFQA_VLAN_MAX, nfqa[NFQA_VLAN], | 1142 | err = nla_parse_nested_deprecated(tb, NFQA_VLAN_MAX, |
1143 | nfqa_vlan_policy, NULL); | 1143 | nfqa[NFQA_VLAN], |
1144 | nfqa_vlan_policy, NULL); | ||
1144 | if (err < 0) | 1145 | if (err < 0) |
1145 | return err; | 1146 | return err; |
1146 | 1147 | ||
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c index 469f9da5073b..276f1f2d6de1 100644 --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c | |||
@@ -198,8 +198,8 @@ static int nft_parse_compat(const struct nlattr *attr, u16 *proto, bool *inv) | |||
198 | u32 flags; | 198 | u32 flags; |
199 | int err; | 199 | int err; |
200 | 200 | ||
201 | err = nla_parse_nested(tb, NFTA_RULE_COMPAT_MAX, attr, | 201 | err = nla_parse_nested_deprecated(tb, NFTA_RULE_COMPAT_MAX, attr, |
202 | nft_rule_compat_policy, NULL); | 202 | nft_rule_compat_policy, NULL); |
203 | if (err < 0) | 203 | if (err < 0) |
204 | return err; | 204 | return err; |
205 | 205 | ||
diff --git a/net/netfilter/nft_ct.c b/net/netfilter/nft_ct.c index 1738ef6dcb56..b422b74bfe08 100644 --- a/net/netfilter/nft_ct.c +++ b/net/netfilter/nft_ct.c | |||
@@ -797,9 +797,11 @@ nft_ct_timeout_parse_policy(void *timeouts, | |||
797 | if (!tb) | 797 | if (!tb) |
798 | return -ENOMEM; | 798 | return -ENOMEM; |
799 | 799 | ||
800 | ret = nla_parse_nested(tb, l4proto->ctnl_timeout.nlattr_max, | 800 | ret = nla_parse_nested_deprecated(tb, |
801 | attr, l4proto->ctnl_timeout.nla_policy, | 801 | l4proto->ctnl_timeout.nlattr_max, |
802 | NULL); | 802 | attr, |
803 | l4proto->ctnl_timeout.nla_policy, | ||
804 | NULL); | ||
803 | if (ret < 0) | 805 | if (ret < 0) |
804 | goto err; | 806 | goto err; |
805 | 807 | ||
diff --git a/net/netfilter/nft_tunnel.c b/net/netfilter/nft_tunnel.c index 66b52d015763..3d4c2ae605a8 100644 --- a/net/netfilter/nft_tunnel.c +++ b/net/netfilter/nft_tunnel.c | |||
@@ -166,8 +166,8 @@ static int nft_tunnel_obj_ip_init(const struct nft_ctx *ctx, | |||
166 | struct nlattr *tb[NFTA_TUNNEL_KEY_IP_MAX + 1]; | 166 | struct nlattr *tb[NFTA_TUNNEL_KEY_IP_MAX + 1]; |
167 | int err; | 167 | int err; |
168 | 168 | ||
169 | err = nla_parse_nested(tb, NFTA_TUNNEL_KEY_IP_MAX, attr, | 169 | err = nla_parse_nested_deprecated(tb, NFTA_TUNNEL_KEY_IP_MAX, attr, |
170 | nft_tunnel_ip_policy, NULL); | 170 | nft_tunnel_ip_policy, NULL); |
171 | if (err < 0) | 171 | if (err < 0) |
172 | return err; | 172 | return err; |
173 | 173 | ||
@@ -195,8 +195,8 @@ static int nft_tunnel_obj_ip6_init(const struct nft_ctx *ctx, | |||
195 | struct nlattr *tb[NFTA_TUNNEL_KEY_IP6_MAX + 1]; | 195 | struct nlattr *tb[NFTA_TUNNEL_KEY_IP6_MAX + 1]; |
196 | int err; | 196 | int err; |
197 | 197 | ||
198 | err = nla_parse_nested(tb, NFTA_TUNNEL_KEY_IP6_MAX, attr, | 198 | err = nla_parse_nested_deprecated(tb, NFTA_TUNNEL_KEY_IP6_MAX, attr, |
199 | nft_tunnel_ip6_policy, NULL); | 199 | nft_tunnel_ip6_policy, NULL); |
200 | if (err < 0) | 200 | if (err < 0) |
201 | return err; | 201 | return err; |
202 | 202 | ||
@@ -231,8 +231,8 @@ static int nft_tunnel_obj_vxlan_init(const struct nlattr *attr, | |||
231 | struct nlattr *tb[NFTA_TUNNEL_KEY_VXLAN_MAX + 1]; | 231 | struct nlattr *tb[NFTA_TUNNEL_KEY_VXLAN_MAX + 1]; |
232 | int err; | 232 | int err; |
233 | 233 | ||
234 | err = nla_parse_nested(tb, NFTA_TUNNEL_KEY_VXLAN_MAX, attr, | 234 | err = nla_parse_nested_deprecated(tb, NFTA_TUNNEL_KEY_VXLAN_MAX, attr, |
235 | nft_tunnel_opts_vxlan_policy, NULL); | 235 | nft_tunnel_opts_vxlan_policy, NULL); |
236 | if (err < 0) | 236 | if (err < 0) |
237 | return err; | 237 | return err; |
238 | 238 | ||
@@ -260,8 +260,9 @@ static int nft_tunnel_obj_erspan_init(const struct nlattr *attr, | |||
260 | uint8_t hwid, dir; | 260 | uint8_t hwid, dir; |
261 | int err, version; | 261 | int err, version; |
262 | 262 | ||
263 | err = nla_parse_nested(tb, NFTA_TUNNEL_KEY_ERSPAN_MAX, attr, | 263 | err = nla_parse_nested_deprecated(tb, NFTA_TUNNEL_KEY_ERSPAN_MAX, |
264 | nft_tunnel_opts_erspan_policy, NULL); | 264 | attr, nft_tunnel_opts_erspan_policy, |
265 | NULL); | ||
265 | if (err < 0) | 266 | if (err < 0) |
266 | return err; | 267 | return err; |
267 | 268 | ||
@@ -309,8 +310,8 @@ static int nft_tunnel_obj_opts_init(const struct nft_ctx *ctx, | |||
309 | struct nlattr *tb[NFTA_TUNNEL_KEY_OPTS_MAX + 1]; | 310 | struct nlattr *tb[NFTA_TUNNEL_KEY_OPTS_MAX + 1]; |
310 | int err; | 311 | int err; |
311 | 312 | ||
312 | err = nla_parse_nested(tb, NFTA_TUNNEL_KEY_OPTS_MAX, attr, | 313 | err = nla_parse_nested_deprecated(tb, NFTA_TUNNEL_KEY_OPTS_MAX, attr, |
313 | nft_tunnel_opts_policy, NULL); | 314 | nft_tunnel_opts_policy, NULL); |
314 | if (err < 0) | 315 | if (err < 0) |
315 | return err; | 316 | return err; |
316 | 317 | ||
diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c index c9775658fb98..8d401df65928 100644 --- a/net/netlabel/netlabel_cipso_v4.c +++ b/net/netlabel/netlabel_cipso_v4.c | |||
@@ -99,9 +99,10 @@ static int netlbl_cipsov4_add_common(struct genl_info *info, | |||
99 | 99 | ||
100 | doi_def->doi = nla_get_u32(info->attrs[NLBL_CIPSOV4_A_DOI]); | 100 | doi_def->doi = nla_get_u32(info->attrs[NLBL_CIPSOV4_A_DOI]); |
101 | 101 | ||
102 | if (nla_validate_nested(info->attrs[NLBL_CIPSOV4_A_TAGLST], | 102 | if (nla_validate_nested_deprecated(info->attrs[NLBL_CIPSOV4_A_TAGLST], |
103 | NLBL_CIPSOV4_A_MAX, | 103 | NLBL_CIPSOV4_A_MAX, |
104 | netlbl_cipsov4_genl_policy, NULL) != 0) | 104 | netlbl_cipsov4_genl_policy, |
105 | NULL) != 0) | ||
105 | return -EINVAL; | 106 | return -EINVAL; |
106 | 107 | ||
107 | nla_for_each_nested(nla, info->attrs[NLBL_CIPSOV4_A_TAGLST], nla_rem) | 108 | nla_for_each_nested(nla, info->attrs[NLBL_CIPSOV4_A_TAGLST], nla_rem) |
@@ -146,9 +147,10 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, | |||
146 | !info->attrs[NLBL_CIPSOV4_A_MLSLVLLST]) | 147 | !info->attrs[NLBL_CIPSOV4_A_MLSLVLLST]) |
147 | return -EINVAL; | 148 | return -EINVAL; |
148 | 149 | ||
149 | if (nla_validate_nested(info->attrs[NLBL_CIPSOV4_A_MLSLVLLST], | 150 | if (nla_validate_nested_deprecated(info->attrs[NLBL_CIPSOV4_A_MLSLVLLST], |
150 | NLBL_CIPSOV4_A_MAX, | 151 | NLBL_CIPSOV4_A_MAX, |
151 | netlbl_cipsov4_genl_policy, NULL) != 0) | 152 | netlbl_cipsov4_genl_policy, |
153 | NULL) != 0) | ||
152 | return -EINVAL; | 154 | return -EINVAL; |
153 | 155 | ||
154 | doi_def = kmalloc(sizeof(*doi_def), GFP_KERNEL); | 156 | doi_def = kmalloc(sizeof(*doi_def), GFP_KERNEL); |
@@ -170,9 +172,10 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, | |||
170 | info->attrs[NLBL_CIPSOV4_A_MLSLVLLST], | 172 | info->attrs[NLBL_CIPSOV4_A_MLSLVLLST], |
171 | nla_a_rem) | 173 | nla_a_rem) |
172 | if (nla_type(nla_a) == NLBL_CIPSOV4_A_MLSLVL) { | 174 | if (nla_type(nla_a) == NLBL_CIPSOV4_A_MLSLVL) { |
173 | if (nla_validate_nested(nla_a, NLBL_CIPSOV4_A_MAX, | 175 | if (nla_validate_nested_deprecated(nla_a, |
174 | netlbl_cipsov4_genl_policy, | 176 | NLBL_CIPSOV4_A_MAX, |
175 | NULL) != 0) | 177 | netlbl_cipsov4_genl_policy, |
178 | NULL) != 0) | ||
176 | goto add_std_failure; | 179 | goto add_std_failure; |
177 | nla_for_each_nested(nla_b, nla_a, nla_b_rem) | 180 | nla_for_each_nested(nla_b, nla_a, nla_b_rem) |
178 | switch (nla_type(nla_b)) { | 181 | switch (nla_type(nla_b)) { |
@@ -234,19 +237,20 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, | |||
234 | } | 237 | } |
235 | 238 | ||
236 | if (info->attrs[NLBL_CIPSOV4_A_MLSCATLST]) { | 239 | if (info->attrs[NLBL_CIPSOV4_A_MLSCATLST]) { |
237 | if (nla_validate_nested(info->attrs[NLBL_CIPSOV4_A_MLSCATLST], | 240 | if (nla_validate_nested_deprecated(info->attrs[NLBL_CIPSOV4_A_MLSCATLST], |
238 | NLBL_CIPSOV4_A_MAX, | 241 | NLBL_CIPSOV4_A_MAX, |
239 | netlbl_cipsov4_genl_policy, NULL) != 0) | 242 | netlbl_cipsov4_genl_policy, |
243 | NULL) != 0) | ||
240 | goto add_std_failure; | 244 | goto add_std_failure; |
241 | 245 | ||
242 | nla_for_each_nested(nla_a, | 246 | nla_for_each_nested(nla_a, |
243 | info->attrs[NLBL_CIPSOV4_A_MLSCATLST], | 247 | info->attrs[NLBL_CIPSOV4_A_MLSCATLST], |
244 | nla_a_rem) | 248 | nla_a_rem) |
245 | if (nla_type(nla_a) == NLBL_CIPSOV4_A_MLSCAT) { | 249 | if (nla_type(nla_a) == NLBL_CIPSOV4_A_MLSCAT) { |
246 | if (nla_validate_nested(nla_a, | 250 | if (nla_validate_nested_deprecated(nla_a, |
247 | NLBL_CIPSOV4_A_MAX, | 251 | NLBL_CIPSOV4_A_MAX, |
248 | netlbl_cipsov4_genl_policy, | 252 | netlbl_cipsov4_genl_policy, |
249 | NULL) != 0) | 253 | NULL) != 0) |
250 | goto add_std_failure; | 254 | goto add_std_failure; |
251 | nla_for_each_nested(nla_b, nla_a, nla_b_rem) | 255 | nla_for_each_nested(nla_b, nla_a, nla_b_rem) |
252 | switch (nla_type(nla_b)) { | 256 | switch (nla_type(nla_b)) { |
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 83e876591f6c..994d9aff2093 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -577,8 +577,9 @@ static int genl_family_rcv_msg(const struct genl_family *family, | |||
577 | attrbuf = family->attrbuf; | 577 | attrbuf = family->attrbuf; |
578 | 578 | ||
579 | if (attrbuf) { | 579 | if (attrbuf) { |
580 | err = nlmsg_parse(nlh, hdrlen, attrbuf, family->maxattr, | 580 | err = nlmsg_parse_deprecated(nlh, hdrlen, attrbuf, |
581 | family->policy, extack); | 581 | family->maxattr, family->policy, |
582 | extack); | ||
582 | if (err < 0) | 583 | if (err < 0) |
583 | goto out; | 584 | goto out; |
584 | } | 585 | } |
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index f91ce7c82746..c6ba308cede7 100644 --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c | |||
@@ -119,9 +119,10 @@ static struct nfc_dev *__get_device_from_cb(struct netlink_callback *cb) | |||
119 | int rc; | 119 | int rc; |
120 | u32 idx; | 120 | u32 idx; |
121 | 121 | ||
122 | rc = nlmsg_parse(cb->nlh, GENL_HDRLEN + nfc_genl_family.hdrsize, | 122 | rc = nlmsg_parse_deprecated(cb->nlh, |
123 | attrbuf, nfc_genl_family.maxattr, nfc_genl_policy, | 123 | GENL_HDRLEN + nfc_genl_family.hdrsize, |
124 | NULL); | 124 | attrbuf, nfc_genl_family.maxattr, |
125 | nfc_genl_policy, NULL); | ||
125 | if (rc < 0) | 126 | if (rc < 0) |
126 | return ERR_PTR(rc); | 127 | return ERR_PTR(rc); |
127 | 128 | ||
@@ -1177,8 +1178,9 @@ static int nfc_genl_llc_sdreq(struct sk_buff *skb, struct genl_info *info) | |||
1177 | tlvs_len = 0; | 1178 | tlvs_len = 0; |
1178 | 1179 | ||
1179 | nla_for_each_nested(attr, info->attrs[NFC_ATTR_LLC_SDP], rem) { | 1180 | nla_for_each_nested(attr, info->attrs[NFC_ATTR_LLC_SDP], rem) { |
1180 | rc = nla_parse_nested(sdp_attrs, NFC_SDP_ATTR_MAX, attr, | 1181 | rc = nla_parse_nested_deprecated(sdp_attrs, NFC_SDP_ATTR_MAX, |
1181 | nfc_sdp_genl_policy, info->extack); | 1182 | attr, nfc_sdp_genl_policy, |
1183 | info->extack); | ||
1182 | 1184 | ||
1183 | if (rc != 0) { | 1185 | if (rc != 0) { |
1184 | rc = -EINVAL; | 1186 | rc = -EINVAL; |
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 356677c3a0c2..3b99fc3de9ac 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -1375,8 +1375,8 @@ static int ovs_flow_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
1375 | u32 ufid_flags; | 1375 | u32 ufid_flags; |
1376 | int err; | 1376 | int err; |
1377 | 1377 | ||
1378 | err = genlmsg_parse(cb->nlh, &dp_flow_genl_family, a, | 1378 | err = genlmsg_parse_deprecated(cb->nlh, &dp_flow_genl_family, a, |
1379 | OVS_FLOW_ATTR_MAX, flow_policy, NULL); | 1379 | OVS_FLOW_ATTR_MAX, flow_policy, NULL); |
1380 | if (err) | 1380 | if (err) |
1381 | return err; | 1381 | return err; |
1382 | ufid_flags = ovs_nla_get_ufid_flags(a[OVS_FLOW_ATTR_UFID_FLAGS]); | 1382 | ufid_flags = ovs_nla_get_ufid_flags(a[OVS_FLOW_ATTR_UFID_FLAGS]); |
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c index 2427b672107a..54eb80dd2dc6 100644 --- a/net/openvswitch/flow_netlink.c +++ b/net/openvswitch/flow_netlink.c | |||
@@ -2854,8 +2854,8 @@ static int validate_userspace(const struct nlattr *attr) | |||
2854 | struct nlattr *a[OVS_USERSPACE_ATTR_MAX + 1]; | 2854 | struct nlattr *a[OVS_USERSPACE_ATTR_MAX + 1]; |
2855 | int error; | 2855 | int error; |
2856 | 2856 | ||
2857 | error = nla_parse_nested(a, OVS_USERSPACE_ATTR_MAX, attr, | 2857 | error = nla_parse_nested_deprecated(a, OVS_USERSPACE_ATTR_MAX, attr, |
2858 | userspace_policy, NULL); | 2858 | userspace_policy, NULL); |
2859 | if (error) | 2859 | if (error) |
2860 | return error; | 2860 | return error; |
2861 | 2861 | ||
@@ -2885,8 +2885,9 @@ static int validate_and_copy_check_pkt_len(struct net *net, | |||
2885 | int nested_acts_start; | 2885 | int nested_acts_start; |
2886 | int start, err; | 2886 | int start, err; |
2887 | 2887 | ||
2888 | err = nla_parse_strict(a, OVS_CHECK_PKT_LEN_ATTR_MAX, nla_data(attr), | 2888 | err = nla_parse_deprecated_strict(a, OVS_CHECK_PKT_LEN_ATTR_MAX, |
2889 | nla_len(attr), cpl_policy, NULL); | 2889 | nla_data(attr), nla_len(attr), |
2890 | cpl_policy, NULL); | ||
2890 | if (err) | 2891 | if (err) |
2891 | return err; | 2892 | return err; |
2892 | 2893 | ||
diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c index fdc8be7fd8f3..9c89e8539a5a 100644 --- a/net/openvswitch/meter.c +++ b/net/openvswitch/meter.c | |||
@@ -227,9 +227,9 @@ static struct dp_meter *dp_meter_create(struct nlattr **a) | |||
227 | struct nlattr *attr[OVS_BAND_ATTR_MAX + 1]; | 227 | struct nlattr *attr[OVS_BAND_ATTR_MAX + 1]; |
228 | u32 band_max_delta_t; | 228 | u32 band_max_delta_t; |
229 | 229 | ||
230 | err = nla_parse((struct nlattr **)&attr, OVS_BAND_ATTR_MAX, | 230 | err = nla_parse_deprecated((struct nlattr **)&attr, |
231 | nla_data(nla), nla_len(nla), band_policy, | 231 | OVS_BAND_ATTR_MAX, nla_data(nla), |
232 | NULL); | 232 | nla_len(nla), band_policy, NULL); |
233 | if (err) | 233 | if (err) |
234 | goto exit_free_meter; | 234 | goto exit_free_meter; |
235 | 235 | ||
diff --git a/net/openvswitch/vport-vxlan.c b/net/openvswitch/vport-vxlan.c index 54965ff8cc66..f3c54871f9e1 100644 --- a/net/openvswitch/vport-vxlan.c +++ b/net/openvswitch/vport-vxlan.c | |||
@@ -70,8 +70,8 @@ static int vxlan_configure_exts(struct vport *vport, struct nlattr *attr, | |||
70 | if (nla_len(attr) < sizeof(struct nlattr)) | 70 | if (nla_len(attr) < sizeof(struct nlattr)) |
71 | return -EINVAL; | 71 | return -EINVAL; |
72 | 72 | ||
73 | err = nla_parse_nested(exts, OVS_VXLAN_EXT_MAX, attr, exts_policy, | 73 | err = nla_parse_nested_deprecated(exts, OVS_VXLAN_EXT_MAX, attr, |
74 | NULL); | 74 | exts_policy, NULL); |
75 | if (err < 0) | 75 | if (err < 0) |
76 | return err; | 76 | return err; |
77 | 77 | ||
diff --git a/net/phonet/pn_netlink.c b/net/phonet/pn_netlink.c index 871eaf2cb85e..be92d936b5d5 100644 --- a/net/phonet/pn_netlink.c +++ b/net/phonet/pn_netlink.c | |||
@@ -79,8 +79,8 @@ static int addr_doit(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
79 | 79 | ||
80 | ASSERT_RTNL(); | 80 | ASSERT_RTNL(); |
81 | 81 | ||
82 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_phonet_policy, | 82 | err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, |
83 | extack); | 83 | ifa_phonet_policy, extack); |
84 | if (err < 0) | 84 | if (err < 0) |
85 | return err; | 85 | return err; |
86 | 86 | ||
@@ -246,8 +246,8 @@ static int route_doit(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
246 | 246 | ||
247 | ASSERT_RTNL(); | 247 | ASSERT_RTNL(); |
248 | 248 | ||
249 | err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_phonet_policy, | 249 | err = nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, |
250 | extack); | 250 | rtm_phonet_policy, extack); |
251 | if (err < 0) | 251 | if (err < 0) |
252 | return err; | 252 | return err; |
253 | 253 | ||
diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index 7c5e8292cc0a..dd0e97f4f6c0 100644 --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c | |||
@@ -1091,7 +1091,8 @@ static int qrtr_addr_doit(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1091 | 1091 | ||
1092 | ASSERT_RTNL(); | 1092 | ASSERT_RTNL(); |
1093 | 1093 | ||
1094 | rc = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, qrtr_policy, extack); | 1094 | rc = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, |
1095 | qrtr_policy, extack); | ||
1095 | if (rc < 0) | 1096 | if (rc < 0) |
1096 | return rc; | 1097 | return rc; |
1097 | 1098 | ||
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 641ad7575f24..683fcc00da49 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -849,7 +849,8 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, | |||
849 | int err; | 849 | int err; |
850 | 850 | ||
851 | if (name == NULL) { | 851 | if (name == NULL) { |
852 | err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL, extack); | 852 | err = nla_parse_nested_deprecated(tb, TCA_ACT_MAX, nla, NULL, |
853 | extack); | ||
853 | if (err < 0) | 854 | if (err < 0) |
854 | goto err_out; | 855 | goto err_out; |
855 | err = -EINVAL; | 856 | err = -EINVAL; |
@@ -964,7 +965,8 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, | |||
964 | int err; | 965 | int err; |
965 | int i; | 966 | int i; |
966 | 967 | ||
967 | err = nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL, extack); | 968 | err = nla_parse_nested_deprecated(tb, TCA_ACT_MAX_PRIO, nla, NULL, |
969 | extack); | ||
968 | if (err < 0) | 970 | if (err < 0) |
969 | return err; | 971 | return err; |
970 | 972 | ||
@@ -1099,7 +1101,7 @@ static struct tc_action *tcf_action_get_1(struct net *net, struct nlattr *nla, | |||
1099 | int index; | 1101 | int index; |
1100 | int err; | 1102 | int err; |
1101 | 1103 | ||
1102 | err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL, extack); | 1104 | err = nla_parse_nested_deprecated(tb, TCA_ACT_MAX, nla, NULL, extack); |
1103 | if (err < 0) | 1105 | if (err < 0) |
1104 | goto err_out; | 1106 | goto err_out; |
1105 | 1107 | ||
@@ -1153,7 +1155,7 @@ static int tca_action_flush(struct net *net, struct nlattr *nla, | |||
1153 | 1155 | ||
1154 | b = skb_tail_pointer(skb); | 1156 | b = skb_tail_pointer(skb); |
1155 | 1157 | ||
1156 | err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL, extack); | 1158 | err = nla_parse_nested_deprecated(tb, TCA_ACT_MAX, nla, NULL, extack); |
1157 | if (err < 0) | 1159 | if (err < 0) |
1158 | goto err_out; | 1160 | goto err_out; |
1159 | 1161 | ||
@@ -1282,7 +1284,8 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n, | |||
1282 | size_t attr_size = 0; | 1284 | size_t attr_size = 0; |
1283 | struct tc_action *actions[TCA_ACT_MAX_PRIO] = {}; | 1285 | struct tc_action *actions[TCA_ACT_MAX_PRIO] = {}; |
1284 | 1286 | ||
1285 | ret = nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL, extack); | 1287 | ret = nla_parse_nested_deprecated(tb, TCA_ACT_MAX_PRIO, nla, NULL, |
1288 | extack); | ||
1286 | if (ret < 0) | 1289 | if (ret < 0) |
1287 | return ret; | 1290 | return ret; |
1288 | 1291 | ||
@@ -1384,8 +1387,8 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, | |||
1384 | !netlink_capable(skb, CAP_NET_ADMIN)) | 1387 | !netlink_capable(skb, CAP_NET_ADMIN)) |
1385 | return -EPERM; | 1388 | return -EPERM; |
1386 | 1389 | ||
1387 | ret = nlmsg_parse(n, sizeof(struct tcamsg), tca, TCA_ROOT_MAX, NULL, | 1390 | ret = nlmsg_parse_deprecated(n, sizeof(struct tcamsg), tca, |
1388 | extack); | 1391 | TCA_ROOT_MAX, NULL, extack); |
1389 | if (ret < 0) | 1392 | if (ret < 0) |
1390 | return ret; | 1393 | return ret; |
1391 | 1394 | ||
@@ -1436,13 +1439,12 @@ static struct nlattr *find_dump_kind(struct nlattr **nla) | |||
1436 | if (tb1 == NULL) | 1439 | if (tb1 == NULL) |
1437 | return NULL; | 1440 | return NULL; |
1438 | 1441 | ||
1439 | if (nla_parse(tb, TCA_ACT_MAX_PRIO, nla_data(tb1), | 1442 | if (nla_parse_deprecated(tb, TCA_ACT_MAX_PRIO, nla_data(tb1), NLMSG_ALIGN(nla_len(tb1)), NULL, NULL) < 0) |
1440 | NLMSG_ALIGN(nla_len(tb1)), NULL, NULL) < 0) | ||
1441 | return NULL; | 1443 | return NULL; |
1442 | 1444 | ||
1443 | if (tb[1] == NULL) | 1445 | if (tb[1] == NULL) |
1444 | return NULL; | 1446 | return NULL; |
1445 | if (nla_parse_nested(tb2, TCA_ACT_MAX, tb[1], NULL, NULL) < 0) | 1447 | if (nla_parse_nested_deprecated(tb2, TCA_ACT_MAX, tb[1], NULL, NULL) < 0) |
1446 | return NULL; | 1448 | return NULL; |
1447 | kind = tb2[TCA_ACT_KIND]; | 1449 | kind = tb2[TCA_ACT_KIND]; |
1448 | 1450 | ||
@@ -1466,8 +1468,8 @@ static int tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) | |||
1466 | u32 msecs_since = 0; | 1468 | u32 msecs_since = 0; |
1467 | u32 act_count = 0; | 1469 | u32 act_count = 0; |
1468 | 1470 | ||
1469 | ret = nlmsg_parse(cb->nlh, sizeof(struct tcamsg), tb, TCA_ROOT_MAX, | 1471 | ret = nlmsg_parse_deprecated(cb->nlh, sizeof(struct tcamsg), tb, |
1470 | tcaa_policy, cb->extack); | 1472 | TCA_ROOT_MAX, tcaa_policy, cb->extack); |
1471 | if (ret < 0) | 1473 | if (ret < 0) |
1472 | return ret; | 1474 | return ret; |
1473 | 1475 | ||
diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c index 3841156aa09f..a0c77faca04b 100644 --- a/net/sched/act_bpf.c +++ b/net/sched/act_bpf.c | |||
@@ -293,7 +293,8 @@ static int tcf_bpf_init(struct net *net, struct nlattr *nla, | |||
293 | if (!nla) | 293 | if (!nla) |
294 | return -EINVAL; | 294 | return -EINVAL; |
295 | 295 | ||
296 | ret = nla_parse_nested(tb, TCA_ACT_BPF_MAX, nla, act_bpf_policy, NULL); | 296 | ret = nla_parse_nested_deprecated(tb, TCA_ACT_BPF_MAX, nla, |
297 | act_bpf_policy, NULL); | ||
297 | if (ret < 0) | 298 | if (ret < 0) |
298 | return ret; | 299 | return ret; |
299 | 300 | ||
diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c index 32ae0cd6e31c..8838575cd536 100644 --- a/net/sched/act_connmark.c +++ b/net/sched/act_connmark.c | |||
@@ -111,8 +111,8 @@ static int tcf_connmark_init(struct net *net, struct nlattr *nla, | |||
111 | if (!nla) | 111 | if (!nla) |
112 | return -EINVAL; | 112 | return -EINVAL; |
113 | 113 | ||
114 | ret = nla_parse_nested(tb, TCA_CONNMARK_MAX, nla, connmark_policy, | 114 | ret = nla_parse_nested_deprecated(tb, TCA_CONNMARK_MAX, nla, |
115 | NULL); | 115 | connmark_policy, NULL); |
116 | if (ret < 0) | 116 | if (ret < 0) |
117 | return ret; | 117 | return ret; |
118 | 118 | ||
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c index 0c77e7bdf6d5..14bb525e355e 100644 --- a/net/sched/act_csum.c +++ b/net/sched/act_csum.c | |||
@@ -61,7 +61,8 @@ static int tcf_csum_init(struct net *net, struct nlattr *nla, | |||
61 | if (nla == NULL) | 61 | if (nla == NULL) |
62 | return -EINVAL; | 62 | return -EINVAL; |
63 | 63 | ||
64 | err = nla_parse_nested(tb, TCA_CSUM_MAX, nla, csum_policy, NULL); | 64 | err = nla_parse_nested_deprecated(tb, TCA_CSUM_MAX, nla, csum_policy, |
65 | NULL); | ||
65 | if (err < 0) | 66 | if (err < 0) |
66 | return err; | 67 | return err; |
67 | 68 | ||
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index e540e31069d7..75492b07f324 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c | |||
@@ -74,7 +74,8 @@ static int tcf_gact_init(struct net *net, struct nlattr *nla, | |||
74 | if (nla == NULL) | 74 | if (nla == NULL) |
75 | return -EINVAL; | 75 | return -EINVAL; |
76 | 76 | ||
77 | err = nla_parse_nested(tb, TCA_GACT_MAX, nla, gact_policy, NULL); | 77 | err = nla_parse_nested_deprecated(tb, TCA_GACT_MAX, nla, gact_policy, |
78 | NULL); | ||
78 | if (err < 0) | 79 | if (err < 0) |
79 | return err; | 80 | return err; |
80 | 81 | ||
diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c index 7a87ce2e5a76..12489f60a979 100644 --- a/net/sched/act_ife.c +++ b/net/sched/act_ife.c | |||
@@ -486,7 +486,8 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla, | |||
486 | int ret = 0; | 486 | int ret = 0; |
487 | int err; | 487 | int err; |
488 | 488 | ||
489 | err = nla_parse_nested(tb, TCA_IFE_MAX, nla, ife_policy, NULL); | 489 | err = nla_parse_nested_deprecated(tb, TCA_IFE_MAX, nla, ife_policy, |
490 | NULL); | ||
490 | if (err < 0) | 491 | if (err < 0) |
491 | return err; | 492 | return err; |
492 | 493 | ||
@@ -567,8 +568,9 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla, | |||
567 | INIT_LIST_HEAD(&ife->metalist); | 568 | INIT_LIST_HEAD(&ife->metalist); |
568 | 569 | ||
569 | if (tb[TCA_IFE_METALST]) { | 570 | if (tb[TCA_IFE_METALST]) { |
570 | err = nla_parse_nested(tb2, IFE_META_MAX, tb[TCA_IFE_METALST], | 571 | err = nla_parse_nested_deprecated(tb2, IFE_META_MAX, |
571 | NULL, NULL); | 572 | tb[TCA_IFE_METALST], NULL, |
573 | NULL); | ||
572 | if (err) | 574 | if (err) |
573 | goto metadata_parse_err; | 575 | goto metadata_parse_err; |
574 | err = populate_metalist(ife, tb2, exists, rtnl_held); | 576 | err = populate_metalist(ife, tb2, exists, rtnl_held); |
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index 04a0b5c61194..ae6e28ab1cd7 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c | |||
@@ -113,7 +113,8 @@ static int __tcf_ipt_init(struct net *net, unsigned int id, struct nlattr *nla, | |||
113 | if (nla == NULL) | 113 | if (nla == NULL) |
114 | return -EINVAL; | 114 | return -EINVAL; |
115 | 115 | ||
116 | err = nla_parse_nested(tb, TCA_IPT_MAX, nla, ipt_policy, NULL); | 116 | err = nla_parse_nested_deprecated(tb, TCA_IPT_MAX, nla, ipt_policy, |
117 | NULL); | ||
117 | if (err < 0) | 118 | if (err < 0) |
118 | return err; | 119 | return err; |
119 | 120 | ||
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index 17cc6bd4c57c..c329390342f4 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c | |||
@@ -111,7 +111,8 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla, | |||
111 | NL_SET_ERR_MSG_MOD(extack, "Mirred requires attributes to be passed"); | 111 | NL_SET_ERR_MSG_MOD(extack, "Mirred requires attributes to be passed"); |
112 | return -EINVAL; | 112 | return -EINVAL; |
113 | } | 113 | } |
114 | ret = nla_parse_nested(tb, TCA_MIRRED_MAX, nla, mirred_policy, extack); | 114 | ret = nla_parse_nested_deprecated(tb, TCA_MIRRED_MAX, nla, |
115 | mirred_policy, extack); | ||
115 | if (ret < 0) | 116 | if (ret < 0) |
116 | return ret; | 117 | return ret; |
117 | if (!tb[TCA_MIRRED_PARMS]) { | 118 | if (!tb[TCA_MIRRED_PARMS]) { |
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c index e91bb8eb81ec..51bd1ba02380 100644 --- a/net/sched/act_nat.c +++ b/net/sched/act_nat.c | |||
@@ -52,7 +52,8 @@ static int tcf_nat_init(struct net *net, struct nlattr *nla, struct nlattr *est, | |||
52 | if (nla == NULL) | 52 | if (nla == NULL) |
53 | return -EINVAL; | 53 | return -EINVAL; |
54 | 54 | ||
55 | err = nla_parse_nested(tb, TCA_NAT_MAX, nla, nat_policy, NULL); | 55 | err = nla_parse_nested_deprecated(tb, TCA_NAT_MAX, nla, nat_policy, |
56 | NULL); | ||
56 | if (err < 0) | 57 | if (err < 0) |
57 | return err; | 58 | return err; |
58 | 59 | ||
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index ce4b54fa7834..d790c02b9c6c 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c | |||
@@ -70,8 +70,9 @@ static struct tcf_pedit_key_ex *tcf_pedit_keys_ex_parse(struct nlattr *nla, | |||
70 | goto err_out; | 70 | goto err_out; |
71 | } | 71 | } |
72 | 72 | ||
73 | err = nla_parse_nested(tb, TCA_PEDIT_KEY_EX_MAX, ka, | 73 | err = nla_parse_nested_deprecated(tb, TCA_PEDIT_KEY_EX_MAX, |
74 | pedit_key_ex_policy, NULL); | 74 | ka, pedit_key_ex_policy, |
75 | NULL); | ||
75 | if (err) | 76 | if (err) |
76 | goto err_out; | 77 | goto err_out; |
77 | 78 | ||
@@ -158,7 +159,8 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla, | |||
158 | return -EINVAL; | 159 | return -EINVAL; |
159 | } | 160 | } |
160 | 161 | ||
161 | err = nla_parse_nested(tb, TCA_PEDIT_MAX, nla, pedit_policy, NULL); | 162 | err = nla_parse_nested_deprecated(tb, TCA_PEDIT_MAX, nla, |
163 | pedit_policy, NULL); | ||
162 | if (err < 0) | 164 | if (err < 0) |
163 | return err; | 165 | return err; |
164 | 166 | ||
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 2b8581f6ab51..b48e40c69ad0 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -100,7 +100,8 @@ static int tcf_police_init(struct net *net, struct nlattr *nla, | |||
100 | if (nla == NULL) | 100 | if (nla == NULL) |
101 | return -EINVAL; | 101 | return -EINVAL; |
102 | 102 | ||
103 | err = nla_parse_nested(tb, TCA_POLICE_MAX, nla, police_policy, NULL); | 103 | err = nla_parse_nested_deprecated(tb, TCA_POLICE_MAX, nla, |
104 | police_policy, NULL); | ||
104 | if (err < 0) | 105 | if (err < 0) |
105 | return err; | 106 | return err; |
106 | 107 | ||
diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c index 0f82d50ea232..b2faa43c1ac7 100644 --- a/net/sched/act_sample.c +++ b/net/sched/act_sample.c | |||
@@ -53,7 +53,8 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla, | |||
53 | 53 | ||
54 | if (!nla) | 54 | if (!nla) |
55 | return -EINVAL; | 55 | return -EINVAL; |
56 | ret = nla_parse_nested(tb, TCA_SAMPLE_MAX, nla, sample_policy, NULL); | 56 | ret = nla_parse_nested_deprecated(tb, TCA_SAMPLE_MAX, nla, |
57 | sample_policy, NULL); | ||
57 | if (ret < 0) | 58 | if (ret < 0) |
58 | return ret; | 59 | return ret; |
59 | if (!tb[TCA_SAMPLE_PARMS] || !tb[TCA_SAMPLE_RATE] || | 60 | if (!tb[TCA_SAMPLE_PARMS] || !tb[TCA_SAMPLE_RATE] || |
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index 23c8ca5615e5..ead480e6014c 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c | |||
@@ -104,7 +104,8 @@ static int tcf_simp_init(struct net *net, struct nlattr *nla, | |||
104 | if (nla == NULL) | 104 | if (nla == NULL) |
105 | return -EINVAL; | 105 | return -EINVAL; |
106 | 106 | ||
107 | err = nla_parse_nested(tb, TCA_DEF_MAX, nla, simple_policy, NULL); | 107 | err = nla_parse_nested_deprecated(tb, TCA_DEF_MAX, nla, simple_policy, |
108 | NULL); | ||
108 | if (err < 0) | 109 | if (err < 0) |
109 | return err; | 110 | return err; |
110 | 111 | ||
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c index 7e1d261a31d2..7ec159b95364 100644 --- a/net/sched/act_skbedit.c +++ b/net/sched/act_skbedit.c | |||
@@ -114,7 +114,8 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla, | |||
114 | if (nla == NULL) | 114 | if (nla == NULL) |
115 | return -EINVAL; | 115 | return -EINVAL; |
116 | 116 | ||
117 | err = nla_parse_nested(tb, TCA_SKBEDIT_MAX, nla, skbedit_policy, NULL); | 117 | err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla, |
118 | skbedit_policy, NULL); | ||
118 | if (err < 0) | 119 | if (err < 0) |
119 | return err; | 120 | return err; |
120 | 121 | ||
diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c index 1d4c324d0a42..186ef98c828f 100644 --- a/net/sched/act_skbmod.c +++ b/net/sched/act_skbmod.c | |||
@@ -102,7 +102,8 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla, | |||
102 | if (!nla) | 102 | if (!nla) |
103 | return -EINVAL; | 103 | return -EINVAL; |
104 | 104 | ||
105 | err = nla_parse_nested(tb, TCA_SKBMOD_MAX, nla, skbmod_policy, NULL); | 105 | err = nla_parse_nested_deprecated(tb, TCA_SKBMOD_MAX, nla, |
106 | skbmod_policy, NULL); | ||
106 | if (err < 0) | 107 | if (err < 0) |
107 | return err; | 108 | return err; |
108 | 109 | ||
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c index 45c0c253c7e8..6a9070511ee8 100644 --- a/net/sched/act_tunnel_key.c +++ b/net/sched/act_tunnel_key.c | |||
@@ -76,8 +76,9 @@ tunnel_key_copy_geneve_opt(const struct nlattr *nla, void *dst, int dst_len, | |||
76 | int err, data_len, opt_len; | 76 | int err, data_len, opt_len; |
77 | u8 *data; | 77 | u8 *data; |
78 | 78 | ||
79 | err = nla_parse_nested(tb, TCA_TUNNEL_KEY_ENC_OPT_GENEVE_MAX, | 79 | err = nla_parse_nested_deprecated(tb, |
80 | nla, geneve_opt_policy, extack); | 80 | TCA_TUNNEL_KEY_ENC_OPT_GENEVE_MAX, |
81 | nla, geneve_opt_policy, extack); | ||
81 | if (err < 0) | 82 | if (err < 0) |
82 | return err; | 83 | return err; |
83 | 84 | ||
@@ -125,8 +126,8 @@ static int tunnel_key_copy_opts(const struct nlattr *nla, u8 *dst, | |||
125 | int err, rem, opt_len, len = nla_len(nla), opts_len = 0; | 126 | int err, rem, opt_len, len = nla_len(nla), opts_len = 0; |
126 | const struct nlattr *attr, *head = nla_data(nla); | 127 | const struct nlattr *attr, *head = nla_data(nla); |
127 | 128 | ||
128 | err = nla_validate(head, len, TCA_TUNNEL_KEY_ENC_OPTS_MAX, | 129 | err = nla_validate_deprecated(head, len, TCA_TUNNEL_KEY_ENC_OPTS_MAX, |
129 | enc_opts_policy, extack); | 130 | enc_opts_policy, extack); |
130 | if (err) | 131 | if (err) |
131 | return err; | 132 | return err; |
132 | 133 | ||
@@ -235,8 +236,8 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla, | |||
235 | return -EINVAL; | 236 | return -EINVAL; |
236 | } | 237 | } |
237 | 238 | ||
238 | err = nla_parse_nested(tb, TCA_TUNNEL_KEY_MAX, nla, tunnel_key_policy, | 239 | err = nla_parse_nested_deprecated(tb, TCA_TUNNEL_KEY_MAX, nla, |
239 | extack); | 240 | tunnel_key_policy, extack); |
240 | if (err < 0) { | 241 | if (err < 0) { |
241 | NL_SET_ERR_MSG(extack, "Failed to parse nested tunnel key attributes"); | 242 | NL_SET_ERR_MSG(extack, "Failed to parse nested tunnel key attributes"); |
242 | return err; | 243 | return err; |
diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c index 0f40d0a74423..39bd9fa3e455 100644 --- a/net/sched/act_vlan.c +++ b/net/sched/act_vlan.c | |||
@@ -124,7 +124,8 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla, | |||
124 | if (!nla) | 124 | if (!nla) |
125 | return -EINVAL; | 125 | return -EINVAL; |
126 | 126 | ||
127 | err = nla_parse_nested(tb, TCA_VLAN_MAX, nla, vlan_policy, NULL); | 127 | err = nla_parse_nested_deprecated(tb, TCA_VLAN_MAX, nla, vlan_policy, |
128 | NULL); | ||
128 | if (err < 0) | 129 | if (err < 0) |
129 | return err; | 130 | return err; |
130 | 131 | ||
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 78de717afddf..263c2ec082c9 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -2006,7 +2006,8 @@ static int tc_new_tfilter(struct sk_buff *skb, struct nlmsghdr *n, | |||
2006 | replay: | 2006 | replay: |
2007 | tp_created = 0; | 2007 | tp_created = 0; |
2008 | 2008 | ||
2009 | err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, rtm_tca_policy, extack); | 2009 | err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX, |
2010 | rtm_tca_policy, extack); | ||
2010 | if (err < 0) | 2011 | if (err < 0) |
2011 | return err; | 2012 | return err; |
2012 | 2013 | ||
@@ -2217,7 +2218,8 @@ static int tc_del_tfilter(struct sk_buff *skb, struct nlmsghdr *n, | |||
2217 | if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) | 2218 | if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) |
2218 | return -EPERM; | 2219 | return -EPERM; |
2219 | 2220 | ||
2220 | err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, rtm_tca_policy, extack); | 2221 | err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX, |
2222 | rtm_tca_policy, extack); | ||
2221 | if (err < 0) | 2223 | if (err < 0) |
2222 | return err; | 2224 | return err; |
2223 | 2225 | ||
@@ -2366,7 +2368,8 @@ static int tc_get_tfilter(struct sk_buff *skb, struct nlmsghdr *n, | |||
2366 | int err; | 2368 | int err; |
2367 | bool rtnl_held = false; | 2369 | bool rtnl_held = false; |
2368 | 2370 | ||
2369 | err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, rtm_tca_policy, extack); | 2371 | err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX, |
2372 | rtm_tca_policy, extack); | ||
2370 | if (err < 0) | 2373 | if (err < 0) |
2371 | return err; | 2374 | return err; |
2372 | 2375 | ||
@@ -2558,8 +2561,8 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) | |||
2558 | if (nlmsg_len(cb->nlh) < sizeof(*tcm)) | 2561 | if (nlmsg_len(cb->nlh) < sizeof(*tcm)) |
2559 | return skb->len; | 2562 | return skb->len; |
2560 | 2563 | ||
2561 | err = nlmsg_parse(cb->nlh, sizeof(*tcm), tca, TCA_MAX, NULL, | 2564 | err = nlmsg_parse_deprecated(cb->nlh, sizeof(*tcm), tca, TCA_MAX, |
2562 | cb->extack); | 2565 | NULL, cb->extack); |
2563 | if (err) | 2566 | if (err) |
2564 | return err; | 2567 | return err; |
2565 | 2568 | ||
@@ -2806,7 +2809,8 @@ static int tc_ctl_chain(struct sk_buff *skb, struct nlmsghdr *n, | |||
2806 | return -EPERM; | 2809 | return -EPERM; |
2807 | 2810 | ||
2808 | replay: | 2811 | replay: |
2809 | err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, rtm_tca_policy, extack); | 2812 | err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX, |
2813 | rtm_tca_policy, extack); | ||
2810 | if (err < 0) | 2814 | if (err < 0) |
2811 | return err; | 2815 | return err; |
2812 | 2816 | ||
@@ -2937,8 +2941,8 @@ static int tc_dump_chain(struct sk_buff *skb, struct netlink_callback *cb) | |||
2937 | if (nlmsg_len(cb->nlh) < sizeof(*tcm)) | 2941 | if (nlmsg_len(cb->nlh) < sizeof(*tcm)) |
2938 | return skb->len; | 2942 | return skb->len; |
2939 | 2943 | ||
2940 | err = nlmsg_parse(cb->nlh, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, | 2944 | err = nlmsg_parse_deprecated(cb->nlh, sizeof(*tcm), tca, TCA_MAX, |
2941 | cb->extack); | 2945 | rtm_tca_policy, cb->extack); |
2942 | if (err) | 2946 | if (err) |
2943 | return err; | 2947 | return err; |
2944 | 2948 | ||
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index dd5fdb62c6df..923863f3b0d8 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c | |||
@@ -185,8 +185,8 @@ static int basic_change(struct net *net, struct sk_buff *in_skb, | |||
185 | if (tca[TCA_OPTIONS] == NULL) | 185 | if (tca[TCA_OPTIONS] == NULL) |
186 | return -EINVAL; | 186 | return -EINVAL; |
187 | 187 | ||
188 | err = nla_parse_nested(tb, TCA_BASIC_MAX, tca[TCA_OPTIONS], | 188 | err = nla_parse_nested_deprecated(tb, TCA_BASIC_MAX, tca[TCA_OPTIONS], |
189 | basic_policy, NULL); | 189 | basic_policy, NULL); |
190 | if (err < 0) | 190 | if (err < 0) |
191 | return err; | 191 | return err; |
192 | 192 | ||
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index 6fd569c5a036..9bcf499cce0c 100644 --- a/net/sched/cls_bpf.c +++ b/net/sched/cls_bpf.c | |||
@@ -468,8 +468,8 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb, | |||
468 | if (tca[TCA_OPTIONS] == NULL) | 468 | if (tca[TCA_OPTIONS] == NULL) |
469 | return -EINVAL; | 469 | return -EINVAL; |
470 | 470 | ||
471 | ret = nla_parse_nested(tb, TCA_BPF_MAX, tca[TCA_OPTIONS], bpf_policy, | 471 | ret = nla_parse_nested_deprecated(tb, TCA_BPF_MAX, tca[TCA_OPTIONS], |
472 | NULL); | 472 | bpf_policy, NULL); |
473 | if (ret < 0) | 473 | if (ret < 0) |
474 | return ret; | 474 | return ret; |
475 | 475 | ||
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c index b680dd684282..037d128c2851 100644 --- a/net/sched/cls_cgroup.c +++ b/net/sched/cls_cgroup.c | |||
@@ -104,8 +104,9 @@ static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb, | |||
104 | goto errout; | 104 | goto errout; |
105 | new->handle = handle; | 105 | new->handle = handle; |
106 | new->tp = tp; | 106 | new->tp = tp; |
107 | err = nla_parse_nested(tb, TCA_CGROUP_MAX, tca[TCA_OPTIONS], | 107 | err = nla_parse_nested_deprecated(tb, TCA_CGROUP_MAX, |
108 | cgroup_policy, NULL); | 108 | tca[TCA_OPTIONS], cgroup_policy, |
109 | NULL); | ||
109 | if (err < 0) | 110 | if (err < 0) |
110 | goto errout; | 111 | goto errout; |
111 | 112 | ||
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c index cb29fe7d5ed3..7bb79ec5b176 100644 --- a/net/sched/cls_flow.c +++ b/net/sched/cls_flow.c | |||
@@ -408,7 +408,8 @@ static int flow_change(struct net *net, struct sk_buff *in_skb, | |||
408 | if (opt == NULL) | 408 | if (opt == NULL) |
409 | return -EINVAL; | 409 | return -EINVAL; |
410 | 410 | ||
411 | err = nla_parse_nested(tb, TCA_FLOW_MAX, opt, flow_policy, NULL); | 411 | err = nla_parse_nested_deprecated(tb, TCA_FLOW_MAX, opt, flow_policy, |
412 | NULL); | ||
412 | if (err < 0) | 413 | if (err < 0) |
413 | return err; | 414 | return err; |
414 | 415 | ||
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 8d4f7a672f14..f6685fc53119 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c | |||
@@ -884,8 +884,9 @@ static int fl_set_geneve_opt(const struct nlattr *nla, struct fl_flow_key *key, | |||
884 | return -EINVAL; | 884 | return -EINVAL; |
885 | } | 885 | } |
886 | 886 | ||
887 | err = nla_parse_nested(tb, TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX, | 887 | err = nla_parse_nested_deprecated(tb, |
888 | nla, geneve_opt_policy, extack); | 888 | TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX, |
889 | nla, geneve_opt_policy, extack); | ||
889 | if (err < 0) | 890 | if (err < 0) |
890 | return err; | 891 | return err; |
891 | 892 | ||
@@ -947,18 +948,18 @@ static int fl_set_enc_opt(struct nlattr **tb, struct fl_flow_key *key, | |||
947 | const struct nlattr *nla_enc_key, *nla_opt_key, *nla_opt_msk = NULL; | 948 | const struct nlattr *nla_enc_key, *nla_opt_key, *nla_opt_msk = NULL; |
948 | int err, option_len, key_depth, msk_depth = 0; | 949 | int err, option_len, key_depth, msk_depth = 0; |
949 | 950 | ||
950 | err = nla_validate_nested(tb[TCA_FLOWER_KEY_ENC_OPTS], | 951 | err = nla_validate_nested_deprecated(tb[TCA_FLOWER_KEY_ENC_OPTS], |
951 | TCA_FLOWER_KEY_ENC_OPTS_MAX, | 952 | TCA_FLOWER_KEY_ENC_OPTS_MAX, |
952 | enc_opts_policy, extack); | 953 | enc_opts_policy, extack); |
953 | if (err) | 954 | if (err) |
954 | return err; | 955 | return err; |
955 | 956 | ||
956 | nla_enc_key = nla_data(tb[TCA_FLOWER_KEY_ENC_OPTS]); | 957 | nla_enc_key = nla_data(tb[TCA_FLOWER_KEY_ENC_OPTS]); |
957 | 958 | ||
958 | if (tb[TCA_FLOWER_KEY_ENC_OPTS_MASK]) { | 959 | if (tb[TCA_FLOWER_KEY_ENC_OPTS_MASK]) { |
959 | err = nla_validate_nested(tb[TCA_FLOWER_KEY_ENC_OPTS_MASK], | 960 | err = nla_validate_nested_deprecated(tb[TCA_FLOWER_KEY_ENC_OPTS_MASK], |
960 | TCA_FLOWER_KEY_ENC_OPTS_MAX, | 961 | TCA_FLOWER_KEY_ENC_OPTS_MAX, |
961 | enc_opts_policy, extack); | 962 | enc_opts_policy, extack); |
962 | if (err) | 963 | if (err) |
963 | return err; | 964 | return err; |
964 | 965 | ||
@@ -1513,8 +1514,8 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, | |||
1513 | goto errout_mask_alloc; | 1514 | goto errout_mask_alloc; |
1514 | } | 1515 | } |
1515 | 1516 | ||
1516 | err = nla_parse_nested(tb, TCA_FLOWER_MAX, tca[TCA_OPTIONS], | 1517 | err = nla_parse_nested_deprecated(tb, TCA_FLOWER_MAX, |
1517 | fl_policy, NULL); | 1518 | tca[TCA_OPTIONS], fl_policy, NULL); |
1518 | if (err < 0) | 1519 | if (err < 0) |
1519 | goto errout_tb; | 1520 | goto errout_tb; |
1520 | 1521 | ||
@@ -1852,8 +1853,8 @@ static void *fl_tmplt_create(struct net *net, struct tcf_chain *chain, | |||
1852 | tb = kcalloc(TCA_FLOWER_MAX + 1, sizeof(struct nlattr *), GFP_KERNEL); | 1853 | tb = kcalloc(TCA_FLOWER_MAX + 1, sizeof(struct nlattr *), GFP_KERNEL); |
1853 | if (!tb) | 1854 | if (!tb) |
1854 | return ERR_PTR(-ENOBUFS); | 1855 | return ERR_PTR(-ENOBUFS); |
1855 | err = nla_parse_nested(tb, TCA_FLOWER_MAX, tca[TCA_OPTIONS], | 1856 | err = nla_parse_nested_deprecated(tb, TCA_FLOWER_MAX, |
1856 | fl_policy, NULL); | 1857 | tca[TCA_OPTIONS], fl_policy, NULL); |
1857 | if (err) | 1858 | if (err) |
1858 | goto errout_tb; | 1859 | goto errout_tb; |
1859 | 1860 | ||
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c index 3fcc1d51b9d7..1d0b39c3932f 100644 --- a/net/sched/cls_fw.c +++ b/net/sched/cls_fw.c | |||
@@ -263,7 +263,8 @@ static int fw_change(struct net *net, struct sk_buff *in_skb, | |||
263 | if (!opt) | 263 | if (!opt) |
264 | return handle ? -EINVAL : 0; /* Succeed if it is old method. */ | 264 | return handle ? -EINVAL : 0; /* Succeed if it is old method. */ |
265 | 265 | ||
266 | err = nla_parse_nested(tb, TCA_FW_MAX, opt, fw_policy, NULL); | 266 | err = nla_parse_nested_deprecated(tb, TCA_FW_MAX, opt, fw_policy, |
267 | NULL); | ||
267 | if (err < 0) | 268 | if (err < 0) |
268 | return err; | 269 | return err; |
269 | 270 | ||
diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c index d54fa8e11b9e..46982b4ea70a 100644 --- a/net/sched/cls_matchall.c +++ b/net/sched/cls_matchall.c | |||
@@ -181,8 +181,8 @@ static int mall_change(struct net *net, struct sk_buff *in_skb, | |||
181 | if (head) | 181 | if (head) |
182 | return -EEXIST; | 182 | return -EEXIST; |
183 | 183 | ||
184 | err = nla_parse_nested(tb, TCA_MATCHALL_MAX, tca[TCA_OPTIONS], | 184 | err = nla_parse_nested_deprecated(tb, TCA_MATCHALL_MAX, |
185 | mall_policy, NULL); | 185 | tca[TCA_OPTIONS], mall_policy, NULL); |
186 | if (err < 0) | 186 | if (err < 0) |
187 | return err; | 187 | return err; |
188 | 188 | ||
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index b3b9b151a61d..eeff5bbfb912 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
@@ -484,7 +484,8 @@ static int route4_change(struct net *net, struct sk_buff *in_skb, | |||
484 | if (opt == NULL) | 484 | if (opt == NULL) |
485 | return handle ? -EINVAL : 0; | 485 | return handle ? -EINVAL : 0; |
486 | 486 | ||
487 | err = nla_parse_nested(tb, TCA_ROUTE4_MAX, opt, route4_policy, NULL); | 487 | err = nla_parse_nested_deprecated(tb, TCA_ROUTE4_MAX, opt, |
488 | route4_policy, NULL); | ||
488 | if (err < 0) | 489 | if (err < 0) |
489 | return err; | 490 | return err; |
490 | 491 | ||
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h index fa059cf934a6..a4688bb92f43 100644 --- a/net/sched/cls_rsvp.h +++ b/net/sched/cls_rsvp.h | |||
@@ -497,7 +497,8 @@ static int rsvp_change(struct net *net, struct sk_buff *in_skb, | |||
497 | if (opt == NULL) | 497 | if (opt == NULL) |
498 | return handle ? -EINVAL : 0; | 498 | return handle ? -EINVAL : 0; |
499 | 499 | ||
500 | err = nla_parse_nested(tb, TCA_RSVP_MAX, opt, rsvp_policy, NULL); | 500 | err = nla_parse_nested_deprecated(tb, TCA_RSVP_MAX, opt, rsvp_policy, |
501 | NULL); | ||
501 | if (err < 0) | 502 | if (err < 0) |
502 | return err; | 503 | return err; |
503 | 504 | ||
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index 1a2e7d5a8776..9f4f4203c388 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c | |||
@@ -510,7 +510,8 @@ tcindex_change(struct net *net, struct sk_buff *in_skb, | |||
510 | if (!opt) | 510 | if (!opt) |
511 | return 0; | 511 | return 0; |
512 | 512 | ||
513 | err = nla_parse_nested(tb, TCA_TCINDEX_MAX, opt, tcindex_policy, NULL); | 513 | err = nla_parse_nested_deprecated(tb, TCA_TCINDEX_MAX, opt, |
514 | tcindex_policy, NULL); | ||
514 | if (err < 0) | 515 | if (err < 0) |
515 | return err; | 516 | return err; |
516 | 517 | ||
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 499477058b2d..04e9ef088535 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -884,7 +884,8 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, | |||
884 | } | 884 | } |
885 | } | 885 | } |
886 | 886 | ||
887 | err = nla_parse_nested(tb, TCA_U32_MAX, opt, u32_policy, extack); | 887 | err = nla_parse_nested_deprecated(tb, TCA_U32_MAX, opt, u32_policy, |
888 | extack); | ||
888 | if (err < 0) | 889 | if (err < 0) |
889 | return err; | 890 | return err; |
890 | 891 | ||
diff --git a/net/sched/em_ipt.c b/net/sched/em_ipt.c index a5f34e930eff..60c26b8294b5 100644 --- a/net/sched/em_ipt.c +++ b/net/sched/em_ipt.c | |||
@@ -120,8 +120,8 @@ static int em_ipt_change(struct net *net, void *data, int data_len, | |||
120 | struct xt_match *match; | 120 | struct xt_match *match; |
121 | int mdata_len, ret; | 121 | int mdata_len, ret; |
122 | 122 | ||
123 | ret = nla_parse(tb, TCA_EM_IPT_MAX, data, data_len, em_ipt_policy, | 123 | ret = nla_parse_deprecated(tb, TCA_EM_IPT_MAX, data, data_len, |
124 | NULL); | 124 | em_ipt_policy, NULL); |
125 | if (ret < 0) | 125 | if (ret < 0) |
126 | return ret; | 126 | return ret; |
127 | 127 | ||
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c index d6e97115500b..28dfa8f2a4ea 100644 --- a/net/sched/em_meta.c +++ b/net/sched/em_meta.c | |||
@@ -912,7 +912,8 @@ static int em_meta_change(struct net *net, void *data, int len, | |||
912 | struct tcf_meta_hdr *hdr; | 912 | struct tcf_meta_hdr *hdr; |
913 | struct meta_match *meta = NULL; | 913 | struct meta_match *meta = NULL; |
914 | 914 | ||
915 | err = nla_parse(tb, TCA_EM_META_MAX, data, len, meta_policy, NULL); | 915 | err = nla_parse_deprecated(tb, TCA_EM_META_MAX, data, len, |
916 | meta_policy, NULL); | ||
916 | if (err < 0) | 917 | if (err < 0) |
917 | goto errout; | 918 | goto errout; |
918 | 919 | ||
diff --git a/net/sched/ematch.c b/net/sched/ematch.c index 6f2d6a761dbe..7b86c2a44746 100644 --- a/net/sched/ematch.c +++ b/net/sched/ematch.c | |||
@@ -314,7 +314,8 @@ int tcf_em_tree_validate(struct tcf_proto *tp, struct nlattr *nla, | |||
314 | if (!nla) | 314 | if (!nla) |
315 | return 0; | 315 | return 0; |
316 | 316 | ||
317 | err = nla_parse_nested(tb, TCA_EMATCH_TREE_MAX, nla, em_policy, NULL); | 317 | err = nla_parse_nested_deprecated(tb, TCA_EMATCH_TREE_MAX, nla, |
318 | em_policy, NULL); | ||
318 | if (err < 0) | 319 | if (err < 0) |
319 | goto errout; | 320 | goto errout; |
320 | 321 | ||
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 6c81b22d214f..607e84d67c33 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -479,7 +479,8 @@ static struct qdisc_size_table *qdisc_get_stab(struct nlattr *opt, | |||
479 | u16 *tab = NULL; | 479 | u16 *tab = NULL; |
480 | int err; | 480 | int err; |
481 | 481 | ||
482 | err = nla_parse_nested(tb, TCA_STAB_MAX, opt, stab_policy, extack); | 482 | err = nla_parse_nested_deprecated(tb, TCA_STAB_MAX, opt, stab_policy, |
483 | extack); | ||
483 | if (err < 0) | 484 | if (err < 0) |
484 | return ERR_PTR(err); | 485 | return ERR_PTR(err); |
485 | if (!tb[TCA_STAB_BASE]) { | 486 | if (!tb[TCA_STAB_BASE]) { |
@@ -1423,8 +1424,8 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, | |||
1423 | !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) | 1424 | !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) |
1424 | return -EPERM; | 1425 | return -EPERM; |
1425 | 1426 | ||
1426 | err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, | 1427 | err = nlmsg_parse_deprecated(n, sizeof(*tcm), tca, TCA_MAX, |
1427 | extack); | 1428 | rtm_tca_policy, extack); |
1428 | if (err < 0) | 1429 | if (err < 0) |
1429 | return err; | 1430 | return err; |
1430 | 1431 | ||
@@ -1508,8 +1509,8 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, | |||
1508 | 1509 | ||
1509 | replay: | 1510 | replay: |
1510 | /* Reinit, just in case something touches this. */ | 1511 | /* Reinit, just in case something touches this. */ |
1511 | err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, | 1512 | err = nlmsg_parse_deprecated(n, sizeof(*tcm), tca, TCA_MAX, |
1512 | extack); | 1513 | rtm_tca_policy, extack); |
1513 | if (err < 0) | 1514 | if (err < 0) |
1514 | return err; | 1515 | return err; |
1515 | 1516 | ||
@@ -1743,8 +1744,8 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) | |||
1743 | idx = 0; | 1744 | idx = 0; |
1744 | ASSERT_RTNL(); | 1745 | ASSERT_RTNL(); |
1745 | 1746 | ||
1746 | err = nlmsg_parse(nlh, sizeof(struct tcmsg), tca, TCA_MAX, | 1747 | err = nlmsg_parse_deprecated(nlh, sizeof(struct tcmsg), tca, TCA_MAX, |
1747 | rtm_tca_policy, cb->extack); | 1748 | rtm_tca_policy, cb->extack); |
1748 | if (err < 0) | 1749 | if (err < 0) |
1749 | return err; | 1750 | return err; |
1750 | 1751 | ||
@@ -1972,8 +1973,8 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, | |||
1972 | !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) | 1973 | !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) |
1973 | return -EPERM; | 1974 | return -EPERM; |
1974 | 1975 | ||
1975 | err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, | 1976 | err = nlmsg_parse_deprecated(n, sizeof(*tcm), tca, TCA_MAX, |
1976 | extack); | 1977 | rtm_tca_policy, extack); |
1977 | if (err < 0) | 1978 | if (err < 0) |
1978 | return err; | 1979 | return err; |
1979 | 1980 | ||
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c index c36aa57eb4af..ae506c7906cd 100644 --- a/net/sched/sch_atm.c +++ b/net/sched/sch_atm.c | |||
@@ -223,7 +223,8 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent, | |||
223 | if (opt == NULL) | 223 | if (opt == NULL) |
224 | return -EINVAL; | 224 | return -EINVAL; |
225 | 225 | ||
226 | error = nla_parse_nested(tb, TCA_ATM_MAX, opt, atm_policy, NULL); | 226 | error = nla_parse_nested_deprecated(tb, TCA_ATM_MAX, opt, atm_policy, |
227 | NULL); | ||
227 | if (error < 0) | 228 | if (error < 0) |
228 | return error; | 229 | return error; |
229 | 230 | ||
diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c index 50db72fe44de..53a80bc6b13a 100644 --- a/net/sched/sch_cake.c +++ b/net/sched/sch_cake.c | |||
@@ -2531,7 +2531,8 @@ static int cake_change(struct Qdisc *sch, struct nlattr *opt, | |||
2531 | if (!opt) | 2531 | if (!opt) |
2532 | return -EINVAL; | 2532 | return -EINVAL; |
2533 | 2533 | ||
2534 | err = nla_parse_nested(tb, TCA_CAKE_MAX, opt, cake_policy, extack); | 2534 | err = nla_parse_nested_deprecated(tb, TCA_CAKE_MAX, opt, cake_policy, |
2535 | extack); | ||
2535 | if (err < 0) | 2536 | if (err < 0) |
2536 | return err; | 2537 | return err; |
2537 | 2538 | ||
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 243bce4b888b..ba4b33b74dd8 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -1149,7 +1149,8 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt, | |||
1149 | return -EINVAL; | 1149 | return -EINVAL; |
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy, extack); | 1152 | err = nla_parse_nested_deprecated(tb, TCA_CBQ_MAX, opt, cbq_policy, |
1153 | extack); | ||
1153 | if (err < 0) | 1154 | if (err < 0) |
1154 | return err; | 1155 | return err; |
1155 | 1156 | ||
@@ -1473,7 +1474,8 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t | |||
1473 | return -EINVAL; | 1474 | return -EINVAL; |
1474 | } | 1475 | } |
1475 | 1476 | ||
1476 | err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy, extack); | 1477 | err = nla_parse_nested_deprecated(tb, TCA_CBQ_MAX, opt, cbq_policy, |
1478 | extack); | ||
1477 | if (err < 0) | 1479 | if (err < 0) |
1478 | return err; | 1480 | return err; |
1479 | 1481 | ||
diff --git a/net/sched/sch_cbs.c b/net/sched/sch_cbs.c index adffc6d68c06..8077c846f5bf 100644 --- a/net/sched/sch_cbs.c +++ b/net/sched/sch_cbs.c | |||
@@ -358,7 +358,8 @@ static int cbs_change(struct Qdisc *sch, struct nlattr *opt, | |||
358 | struct tc_cbs_qopt *qopt; | 358 | struct tc_cbs_qopt *qopt; |
359 | int err; | 359 | int err; |
360 | 360 | ||
361 | err = nla_parse_nested(tb, TCA_CBS_MAX, opt, cbs_policy, extack); | 361 | err = nla_parse_nested_deprecated(tb, TCA_CBS_MAX, opt, cbs_policy, |
362 | extack); | ||
362 | if (err < 0) | 363 | if (err < 0) |
363 | return err; | 364 | return err; |
364 | 365 | ||
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c index eda21dc94bde..370dbcf49e8b 100644 --- a/net/sched/sch_choke.c +++ b/net/sched/sch_choke.c | |||
@@ -358,7 +358,8 @@ static int choke_change(struct Qdisc *sch, struct nlattr *opt, | |||
358 | if (opt == NULL) | 358 | if (opt == NULL) |
359 | return -EINVAL; | 359 | return -EINVAL; |
360 | 360 | ||
361 | err = nla_parse_nested(tb, TCA_CHOKE_MAX, opt, choke_policy, NULL); | 361 | err = nla_parse_nested_deprecated(tb, TCA_CHOKE_MAX, opt, |
362 | choke_policy, NULL); | ||
362 | if (err < 0) | 363 | if (err < 0) |
363 | return err; | 364 | return err; |
364 | 365 | ||
diff --git a/net/sched/sch_codel.c b/net/sched/sch_codel.c index 60ac4e61ce3a..25ef172c23df 100644 --- a/net/sched/sch_codel.c +++ b/net/sched/sch_codel.c | |||
@@ -141,7 +141,8 @@ static int codel_change(struct Qdisc *sch, struct nlattr *opt, | |||
141 | if (!opt) | 141 | if (!opt) |
142 | return -EINVAL; | 142 | return -EINVAL; |
143 | 143 | ||
144 | err = nla_parse_nested(tb, TCA_CODEL_MAX, opt, codel_policy, NULL); | 144 | err = nla_parse_nested_deprecated(tb, TCA_CODEL_MAX, opt, |
145 | codel_policy, NULL); | ||
145 | if (err < 0) | 146 | if (err < 0) |
146 | return err; | 147 | return err; |
147 | 148 | ||
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c index 022db73fd5a9..ffcd6654c39d 100644 --- a/net/sched/sch_drr.c +++ b/net/sched/sch_drr.c | |||
@@ -70,7 +70,8 @@ static int drr_change_class(struct Qdisc *sch, u32 classid, u32 parentid, | |||
70 | return -EINVAL; | 70 | return -EINVAL; |
71 | } | 71 | } |
72 | 72 | ||
73 | err = nla_parse_nested(tb, TCA_DRR_MAX, opt, drr_policy, extack); | 73 | err = nla_parse_nested_deprecated(tb, TCA_DRR_MAX, opt, drr_policy, |
74 | extack); | ||
74 | if (err < 0) | 75 | if (err < 0) |
75 | return err; | 76 | return err; |
76 | 77 | ||
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c index cdf744e710f1..3deeb06eaecf 100644 --- a/net/sched/sch_dsmark.c +++ b/net/sched/sch_dsmark.c | |||
@@ -132,7 +132,8 @@ static int dsmark_change(struct Qdisc *sch, u32 classid, u32 parent, | |||
132 | if (!opt) | 132 | if (!opt) |
133 | goto errout; | 133 | goto errout; |
134 | 134 | ||
135 | err = nla_parse_nested(tb, TCA_DSMARK_MAX, opt, dsmark_policy, NULL); | 135 | err = nla_parse_nested_deprecated(tb, TCA_DSMARK_MAX, opt, |
136 | dsmark_policy, NULL); | ||
136 | if (err < 0) | 137 | if (err < 0) |
137 | goto errout; | 138 | goto errout; |
138 | 139 | ||
@@ -353,7 +354,8 @@ static int dsmark_init(struct Qdisc *sch, struct nlattr *opt, | |||
353 | if (err) | 354 | if (err) |
354 | return err; | 355 | return err; |
355 | 356 | ||
356 | err = nla_parse_nested(tb, TCA_DSMARK_MAX, opt, dsmark_policy, NULL); | 357 | err = nla_parse_nested_deprecated(tb, TCA_DSMARK_MAX, opt, |
358 | dsmark_policy, NULL); | ||
357 | if (err < 0) | 359 | if (err < 0) |
358 | goto errout; | 360 | goto errout; |
359 | 361 | ||
diff --git a/net/sched/sch_etf.c b/net/sched/sch_etf.c index 67107caa287c..db0c2ba1d156 100644 --- a/net/sched/sch_etf.c +++ b/net/sched/sch_etf.c | |||
@@ -351,7 +351,8 @@ static int etf_init(struct Qdisc *sch, struct nlattr *opt, | |||
351 | return -EINVAL; | 351 | return -EINVAL; |
352 | } | 352 | } |
353 | 353 | ||
354 | err = nla_parse_nested(tb, TCA_ETF_MAX, opt, etf_policy, extack); | 354 | err = nla_parse_nested_deprecated(tb, TCA_ETF_MAX, opt, etf_policy, |
355 | extack); | ||
355 | if (err < 0) | 356 | if (err < 0) |
356 | return err; | 357 | return err; |
357 | 358 | ||
diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c index 5ca370e78d3a..d107c74767cd 100644 --- a/net/sched/sch_fq.c +++ b/net/sched/sch_fq.c | |||
@@ -684,7 +684,8 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt, | |||
684 | if (!opt) | 684 | if (!opt) |
685 | return -EINVAL; | 685 | return -EINVAL; |
686 | 686 | ||
687 | err = nla_parse_nested(tb, TCA_FQ_MAX, opt, fq_policy, NULL); | 687 | err = nla_parse_nested_deprecated(tb, TCA_FQ_MAX, opt, fq_policy, |
688 | NULL); | ||
688 | if (err < 0) | 689 | if (err < 0) |
689 | return err; | 690 | return err; |
690 | 691 | ||
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c index 825a933b019a..08d85370b97c 100644 --- a/net/sched/sch_fq_codel.c +++ b/net/sched/sch_fq_codel.c | |||
@@ -387,8 +387,8 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt, | |||
387 | if (!opt) | 387 | if (!opt) |
388 | return -EINVAL; | 388 | return -EINVAL; |
389 | 389 | ||
390 | err = nla_parse_nested(tb, TCA_FQ_CODEL_MAX, opt, fq_codel_policy, | 390 | err = nla_parse_nested_deprecated(tb, TCA_FQ_CODEL_MAX, opt, |
391 | NULL); | 391 | fq_codel_policy, NULL); |
392 | if (err < 0) | 392 | if (err < 0) |
393 | return err; | 393 | return err; |
394 | if (tb[TCA_FQ_CODEL_FLOWS]) { | 394 | if (tb[TCA_FQ_CODEL_FLOWS]) { |
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c index 9bfa15e12d23..dfa657da100f 100644 --- a/net/sched/sch_gred.c +++ b/net/sched/sch_gred.c | |||
@@ -538,7 +538,8 @@ static void gred_vq_apply(struct gred_sched *table, const struct nlattr *entry) | |||
538 | struct nlattr *tb[TCA_GRED_VQ_MAX + 1]; | 538 | struct nlattr *tb[TCA_GRED_VQ_MAX + 1]; |
539 | u32 dp; | 539 | u32 dp; |
540 | 540 | ||
541 | nla_parse_nested(tb, TCA_GRED_VQ_MAX, entry, gred_vq_policy, NULL); | 541 | nla_parse_nested_deprecated(tb, TCA_GRED_VQ_MAX, entry, |
542 | gred_vq_policy, NULL); | ||
542 | 543 | ||
543 | dp = nla_get_u32(tb[TCA_GRED_VQ_DP]); | 544 | dp = nla_get_u32(tb[TCA_GRED_VQ_DP]); |
544 | 545 | ||
@@ -568,8 +569,8 @@ static int gred_vq_validate(struct gred_sched *table, u32 cdp, | |||
568 | int err; | 569 | int err; |
569 | u32 dp; | 570 | u32 dp; |
570 | 571 | ||
571 | err = nla_parse_nested(tb, TCA_GRED_VQ_MAX, entry, gred_vq_policy, | 572 | err = nla_parse_nested_deprecated(tb, TCA_GRED_VQ_MAX, entry, |
572 | extack); | 573 | gred_vq_policy, extack); |
573 | if (err < 0) | 574 | if (err < 0) |
574 | return err; | 575 | return err; |
575 | 576 | ||
@@ -610,8 +611,8 @@ static int gred_vqs_validate(struct gred_sched *table, u32 cdp, | |||
610 | const struct nlattr *attr; | 611 | const struct nlattr *attr; |
611 | int rem, err; | 612 | int rem, err; |
612 | 613 | ||
613 | err = nla_validate_nested(vqs, TCA_GRED_VQ_ENTRY_MAX, | 614 | err = nla_validate_nested_deprecated(vqs, TCA_GRED_VQ_ENTRY_MAX, |
614 | gred_vqe_policy, extack); | 615 | gred_vqe_policy, extack); |
615 | if (err < 0) | 616 | if (err < 0) |
616 | return err; | 617 | return err; |
617 | 618 | ||
@@ -650,7 +651,8 @@ static int gred_change(struct Qdisc *sch, struct nlattr *opt, | |||
650 | if (opt == NULL) | 651 | if (opt == NULL) |
651 | return -EINVAL; | 652 | return -EINVAL; |
652 | 653 | ||
653 | err = nla_parse_nested(tb, TCA_GRED_MAX, opt, gred_policy, extack); | 654 | err = nla_parse_nested_deprecated(tb, TCA_GRED_MAX, opt, gred_policy, |
655 | extack); | ||
654 | if (err < 0) | 656 | if (err < 0) |
655 | return err; | 657 | return err; |
656 | 658 | ||
@@ -737,7 +739,8 @@ static int gred_init(struct Qdisc *sch, struct nlattr *opt, | |||
737 | if (!opt) | 739 | if (!opt) |
738 | return -EINVAL; | 740 | return -EINVAL; |
739 | 741 | ||
740 | err = nla_parse_nested(tb, TCA_GRED_MAX, opt, gred_policy, extack); | 742 | err = nla_parse_nested_deprecated(tb, TCA_GRED_MAX, opt, gred_policy, |
743 | extack); | ||
741 | if (err < 0) | 744 | if (err < 0) |
742 | return err; | 745 | return err; |
743 | 746 | ||
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 97d2fb91c39f..433f2190960f 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
@@ -926,7 +926,8 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid, | |||
926 | if (opt == NULL) | 926 | if (opt == NULL) |
927 | return -EINVAL; | 927 | return -EINVAL; |
928 | 928 | ||
929 | err = nla_parse_nested(tb, TCA_HFSC_MAX, opt, hfsc_policy, NULL); | 929 | err = nla_parse_nested_deprecated(tb, TCA_HFSC_MAX, opt, hfsc_policy, |
930 | NULL); | ||
930 | if (err < 0) | 931 | if (err < 0) |
931 | return err; | 932 | return err; |
932 | 933 | ||
diff --git a/net/sched/sch_hhf.c b/net/sched/sch_hhf.c index 43bc159c4f7c..a28e09b1609c 100644 --- a/net/sched/sch_hhf.c +++ b/net/sched/sch_hhf.c | |||
@@ -518,7 +518,8 @@ static int hhf_change(struct Qdisc *sch, struct nlattr *opt, | |||
518 | if (!opt) | 518 | if (!opt) |
519 | return -EINVAL; | 519 | return -EINVAL; |
520 | 520 | ||
521 | err = nla_parse_nested(tb, TCA_HHF_MAX, opt, hhf_policy, NULL); | 521 | err = nla_parse_nested_deprecated(tb, TCA_HHF_MAX, opt, hhf_policy, |
522 | NULL); | ||
522 | if (err < 0) | 523 | if (err < 0) |
523 | return err; | 524 | return err; |
524 | 525 | ||
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 64010aec5437..d27d9bc9d010 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -1012,7 +1012,8 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt, | |||
1012 | if (err) | 1012 | if (err) |
1013 | return err; | 1013 | return err; |
1014 | 1014 | ||
1015 | err = nla_parse_nested(tb, TCA_HTB_MAX, opt, htb_policy, NULL); | 1015 | err = nla_parse_nested_deprecated(tb, TCA_HTB_MAX, opt, htb_policy, |
1016 | NULL); | ||
1016 | if (err < 0) | 1017 | if (err < 0) |
1017 | return err; | 1018 | return err; |
1018 | 1019 | ||
@@ -1310,7 +1311,8 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, | |||
1310 | if (!opt) | 1311 | if (!opt) |
1311 | goto failure; | 1312 | goto failure; |
1312 | 1313 | ||
1313 | err = nla_parse_nested(tb, TCA_HTB_MAX, opt, htb_policy, NULL); | 1314 | err = nla_parse_nested_deprecated(tb, TCA_HTB_MAX, opt, htb_policy, |
1315 | NULL); | ||
1314 | if (err < 0) | 1316 | if (err < 0) |
1315 | goto failure; | 1317 | goto failure; |
1316 | 1318 | ||
diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c index 7afefed72d35..d05086dc3866 100644 --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c | |||
@@ -125,8 +125,9 @@ static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla, | |||
125 | int nested_len = nla_len(nla) - NLA_ALIGN(len); | 125 | int nested_len = nla_len(nla) - NLA_ALIGN(len); |
126 | 126 | ||
127 | if (nested_len >= nla_attr_size(0)) | 127 | if (nested_len >= nla_attr_size(0)) |
128 | return nla_parse(tb, maxtype, nla_data(nla) + NLA_ALIGN(len), | 128 | return nla_parse_deprecated(tb, maxtype, |
129 | nested_len, policy, NULL); | 129 | nla_data(nla) + NLA_ALIGN(len), |
130 | nested_len, policy, NULL); | ||
130 | 131 | ||
131 | memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); | 132 | memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); |
132 | return 0; | 133 | return 0; |
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 0242c0d4a2d0..78aa76b0da2e 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -935,8 +935,9 @@ static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla, | |||
935 | } | 935 | } |
936 | 936 | ||
937 | if (nested_len >= nla_attr_size(0)) | 937 | if (nested_len >= nla_attr_size(0)) |
938 | return nla_parse(tb, maxtype, nla_data(nla) + NLA_ALIGN(len), | 938 | return nla_parse_deprecated(tb, maxtype, |
939 | nested_len, policy, NULL); | 939 | nla_data(nla) + NLA_ALIGN(len), |
940 | nested_len, policy, NULL); | ||
940 | 941 | ||
941 | memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); | 942 | memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); |
942 | return 0; | 943 | return 0; |
diff --git a/net/sched/sch_pie.c b/net/sched/sch_pie.c index 9bf41f4a2312..8fa129d3943e 100644 --- a/net/sched/sch_pie.c +++ b/net/sched/sch_pie.c | |||
@@ -216,7 +216,8 @@ static int pie_change(struct Qdisc *sch, struct nlattr *opt, | |||
216 | if (!opt) | 216 | if (!opt) |
217 | return -EINVAL; | 217 | return -EINVAL; |
218 | 218 | ||
219 | err = nla_parse_nested(tb, TCA_PIE_MAX, opt, pie_policy, NULL); | 219 | err = nla_parse_nested_deprecated(tb, TCA_PIE_MAX, opt, pie_policy, |
220 | NULL); | ||
220 | if (err < 0) | 221 | if (err < 0) |
221 | return err; | 222 | return err; |
222 | 223 | ||
diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c index bab2d4026e8b..3f9e8b425ac6 100644 --- a/net/sched/sch_qfq.c +++ b/net/sched/sch_qfq.c | |||
@@ -410,8 +410,8 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, | |||
410 | return -EINVAL; | 410 | return -EINVAL; |
411 | } | 411 | } |
412 | 412 | ||
413 | err = nla_parse_nested(tb, TCA_QFQ_MAX, tca[TCA_OPTIONS], qfq_policy, | 413 | err = nla_parse_nested_deprecated(tb, TCA_QFQ_MAX, tca[TCA_OPTIONS], |
414 | NULL); | 414 | qfq_policy, NULL); |
415 | if (err < 0) | 415 | if (err < 0) |
416 | return err; | 416 | return err; |
417 | 417 | ||
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c index b9f34e057e87..1e68a13bb66b 100644 --- a/net/sched/sch_red.c +++ b/net/sched/sch_red.c | |||
@@ -205,7 +205,8 @@ static int red_change(struct Qdisc *sch, struct nlattr *opt, | |||
205 | if (opt == NULL) | 205 | if (opt == NULL) |
206 | return -EINVAL; | 206 | return -EINVAL; |
207 | 207 | ||
208 | err = nla_parse_nested(tb, TCA_RED_MAX, opt, red_policy, NULL); | 208 | err = nla_parse_nested_deprecated(tb, TCA_RED_MAX, opt, red_policy, |
209 | NULL); | ||
209 | if (err < 0) | 210 | if (err < 0) |
210 | return err; | 211 | return err; |
211 | 212 | ||
diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c index f54b00a431a3..b245d6a2068d 100644 --- a/net/sched/sch_sfb.c +++ b/net/sched/sch_sfb.c | |||
@@ -499,7 +499,8 @@ static int sfb_change(struct Qdisc *sch, struct nlattr *opt, | |||
499 | int err; | 499 | int err; |
500 | 500 | ||
501 | if (opt) { | 501 | if (opt) { |
502 | err = nla_parse_nested(tb, TCA_SFB_MAX, opt, sfb_policy, NULL); | 502 | err = nla_parse_nested_deprecated(tb, TCA_SFB_MAX, opt, |
503 | sfb_policy, NULL); | ||
503 | if (err < 0) | 504 | if (err < 0) |
504 | return -EINVAL; | 505 | return -EINVAL; |
505 | 506 | ||
diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index e016ee07dd1f..09563c245473 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c | |||
@@ -310,8 +310,8 @@ static int parse_sched_entry(struct nlattr *n, struct sched_entry *entry, | |||
310 | struct nlattr *tb[TCA_TAPRIO_SCHED_ENTRY_MAX + 1] = { }; | 310 | struct nlattr *tb[TCA_TAPRIO_SCHED_ENTRY_MAX + 1] = { }; |
311 | int err; | 311 | int err; |
312 | 312 | ||
313 | err = nla_parse_nested(tb, TCA_TAPRIO_SCHED_ENTRY_MAX, n, | 313 | err = nla_parse_nested_deprecated(tb, TCA_TAPRIO_SCHED_ENTRY_MAX, n, |
314 | entry_policy, NULL); | 314 | entry_policy, NULL); |
315 | if (err < 0) { | 315 | if (err < 0) { |
316 | NL_SET_ERR_MSG(extack, "Could not parse nested entry"); | 316 | NL_SET_ERR_MSG(extack, "Could not parse nested entry"); |
317 | return -EINVAL; | 317 | return -EINVAL; |
@@ -334,8 +334,8 @@ static int parse_sched_single_entry(struct nlattr *n, | |||
334 | u32 index; | 334 | u32 index; |
335 | int err; | 335 | int err; |
336 | 336 | ||
337 | err = nla_parse_nested(tb_list, TCA_TAPRIO_SCHED_MAX, | 337 | err = nla_parse_nested_deprecated(tb_list, TCA_TAPRIO_SCHED_MAX, n, |
338 | n, entry_list_policy, NULL); | 338 | entry_list_policy, NULL); |
339 | if (err < 0) { | 339 | if (err < 0) { |
340 | NL_SET_ERR_MSG(extack, "Could not parse nested entry"); | 340 | NL_SET_ERR_MSG(extack, "Could not parse nested entry"); |
341 | return -EINVAL; | 341 | return -EINVAL; |
@@ -346,9 +346,10 @@ static int parse_sched_single_entry(struct nlattr *n, | |||
346 | return -EINVAL; | 346 | return -EINVAL; |
347 | } | 347 | } |
348 | 348 | ||
349 | err = nla_parse_nested(tb_entry, TCA_TAPRIO_SCHED_ENTRY_MAX, | 349 | err = nla_parse_nested_deprecated(tb_entry, |
350 | tb_list[TCA_TAPRIO_SCHED_ENTRY], | 350 | TCA_TAPRIO_SCHED_ENTRY_MAX, |
351 | entry_policy, NULL); | 351 | tb_list[TCA_TAPRIO_SCHED_ENTRY], |
352 | entry_policy, NULL); | ||
352 | if (err < 0) { | 353 | if (err < 0) { |
353 | NL_SET_ERR_MSG(extack, "Could not parse nested entry"); | 354 | NL_SET_ERR_MSG(extack, "Could not parse nested entry"); |
354 | return -EINVAL; | 355 | return -EINVAL; |
@@ -644,8 +645,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, | |||
644 | int i, err, size; | 645 | int i, err, size; |
645 | ktime_t start; | 646 | ktime_t start; |
646 | 647 | ||
647 | err = nla_parse_nested(tb, TCA_TAPRIO_ATTR_MAX, opt, | 648 | err = nla_parse_nested_deprecated(tb, TCA_TAPRIO_ATTR_MAX, opt, |
648 | taprio_policy, extack); | 649 | taprio_policy, extack); |
649 | if (err < 0) | 650 | if (err < 0) |
650 | return err; | 651 | return err; |
651 | 652 | ||
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index 3ae5a29eeab3..c09c0d855846 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c | |||
@@ -308,7 +308,8 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt, | |||
308 | s64 buffer, mtu; | 308 | s64 buffer, mtu; |
309 | u64 rate64 = 0, prate64 = 0; | 309 | u64 rate64 = 0, prate64 = 0; |
310 | 310 | ||
311 | err = nla_parse_nested(tb, TCA_TBF_MAX, opt, tbf_policy, NULL); | 311 | err = nla_parse_nested_deprecated(tb, TCA_TBF_MAX, opt, tbf_policy, |
312 | NULL); | ||
312 | if (err < 0) | 313 | if (err < 0) |
313 | return err; | 314 | return err; |
314 | 315 | ||
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 | ||
262 | int __init tipc_netlink_start(void) | 262 | int __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]) { |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 0bcd5ea4b4f2..782c8225a90a 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -703,9 +703,11 @@ int nl80211_prepare_wdev_dump(struct netlink_callback *cb, | |||
703 | int err; | 703 | int err; |
704 | 704 | ||
705 | if (!cb->args[0]) { | 705 | if (!cb->args[0]) { |
706 | err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize, | 706 | err = nlmsg_parse_deprecated(cb->nlh, |
707 | genl_family_attrbuf(&nl80211_fam), | 707 | GENL_HDRLEN + nl80211_fam.hdrsize, |
708 | nl80211_fam.maxattr, nl80211_policy, NULL); | 708 | genl_family_attrbuf(&nl80211_fam), |
709 | nl80211_fam.maxattr, | ||
710 | nl80211_policy, NULL); | ||
709 | if (err) | 711 | if (err) |
710 | return err; | 712 | return err; |
711 | 713 | ||
@@ -925,8 +927,9 @@ static int nl80211_parse_key_new(struct genl_info *info, struct nlattr *key, | |||
925 | struct key_parse *k) | 927 | struct key_parse *k) |
926 | { | 928 | { |
927 | struct nlattr *tb[NL80211_KEY_MAX + 1]; | 929 | struct nlattr *tb[NL80211_KEY_MAX + 1]; |
928 | int err = nla_parse_nested(tb, NL80211_KEY_MAX, key, | 930 | int err = nla_parse_nested_deprecated(tb, NL80211_KEY_MAX, key, |
929 | nl80211_key_policy, info->extack); | 931 | nl80211_key_policy, |
932 | info->extack); | ||
930 | if (err) | 933 | if (err) |
931 | return err; | 934 | return err; |
932 | 935 | ||
@@ -962,10 +965,11 @@ static int nl80211_parse_key_new(struct genl_info *info, struct nlattr *key, | |||
962 | if (tb[NL80211_KEY_DEFAULT_TYPES]) { | 965 | if (tb[NL80211_KEY_DEFAULT_TYPES]) { |
963 | struct nlattr *kdt[NUM_NL80211_KEY_DEFAULT_TYPES]; | 966 | struct nlattr *kdt[NUM_NL80211_KEY_DEFAULT_TYPES]; |
964 | 967 | ||
965 | err = nla_parse_nested(kdt, NUM_NL80211_KEY_DEFAULT_TYPES - 1, | 968 | err = nla_parse_nested_deprecated(kdt, |
966 | tb[NL80211_KEY_DEFAULT_TYPES], | 969 | NUM_NL80211_KEY_DEFAULT_TYPES - 1, |
967 | nl80211_key_default_policy, | 970 | tb[NL80211_KEY_DEFAULT_TYPES], |
968 | info->extack); | 971 | nl80211_key_default_policy, |
972 | info->extack); | ||
969 | if (err) | 973 | if (err) |
970 | return err; | 974 | return err; |
971 | 975 | ||
@@ -1012,11 +1016,11 @@ static int nl80211_parse_key_old(struct genl_info *info, struct key_parse *k) | |||
1012 | 1016 | ||
1013 | if (info->attrs[NL80211_ATTR_KEY_DEFAULT_TYPES]) { | 1017 | if (info->attrs[NL80211_ATTR_KEY_DEFAULT_TYPES]) { |
1014 | struct nlattr *kdt[NUM_NL80211_KEY_DEFAULT_TYPES]; | 1018 | struct nlattr *kdt[NUM_NL80211_KEY_DEFAULT_TYPES]; |
1015 | int err = nla_parse_nested(kdt, | 1019 | int err = nla_parse_nested_deprecated(kdt, |
1016 | NUM_NL80211_KEY_DEFAULT_TYPES - 1, | 1020 | NUM_NL80211_KEY_DEFAULT_TYPES - 1, |
1017 | info->attrs[NL80211_ATTR_KEY_DEFAULT_TYPES], | 1021 | info->attrs[NL80211_ATTR_KEY_DEFAULT_TYPES], |
1018 | nl80211_key_default_policy, | 1022 | nl80211_key_default_policy, |
1019 | info->extack); | 1023 | info->extack); |
1020 | if (err) | 1024 | if (err) |
1021 | return err; | 1025 | return err; |
1022 | 1026 | ||
@@ -2317,8 +2321,10 @@ static int nl80211_dump_wiphy_parse(struct sk_buff *skb, | |||
2317 | struct nl80211_dump_wiphy_state *state) | 2321 | struct nl80211_dump_wiphy_state *state) |
2318 | { | 2322 | { |
2319 | struct nlattr **tb = genl_family_attrbuf(&nl80211_fam); | 2323 | struct nlattr **tb = genl_family_attrbuf(&nl80211_fam); |
2320 | int ret = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize, tb, | 2324 | int ret = nlmsg_parse_deprecated(cb->nlh, |
2321 | nl80211_fam.maxattr, nl80211_policy, NULL); | 2325 | GENL_HDRLEN + nl80211_fam.hdrsize, |
2326 | tb, nl80211_fam.maxattr, | ||
2327 | nl80211_policy, NULL); | ||
2322 | /* ignore parse errors for backward compatibility */ | 2328 | /* ignore parse errors for backward compatibility */ |
2323 | if (ret) | 2329 | if (ret) |
2324 | return 0; | 2330 | return 0; |
@@ -2761,10 +2767,11 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
2761 | nla_for_each_nested(nl_txq_params, | 2767 | nla_for_each_nested(nl_txq_params, |
2762 | info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS], | 2768 | info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS], |
2763 | rem_txq_params) { | 2769 | rem_txq_params) { |
2764 | result = nla_parse_nested(tb, NL80211_TXQ_ATTR_MAX, | 2770 | result = nla_parse_nested_deprecated(tb, |
2765 | nl_txq_params, | 2771 | NL80211_TXQ_ATTR_MAX, |
2766 | txq_params_policy, | 2772 | nl_txq_params, |
2767 | info->extack); | 2773 | txq_params_policy, |
2774 | info->extack); | ||
2768 | if (result) | 2775 | if (result) |
2769 | return result; | 2776 | return result; |
2770 | result = parse_txq_params(tb, &txq_params); | 2777 | result = parse_txq_params(tb, &txq_params); |
@@ -3221,8 +3228,7 @@ static int parse_monitor_flags(struct nlattr *nla, u32 *mntrflags) | |||
3221 | if (!nla) | 3228 | if (!nla) |
3222 | return -EINVAL; | 3229 | return -EINVAL; |
3223 | 3230 | ||
3224 | if (nla_parse_nested(flags, NL80211_MNTR_FLAG_MAX, nla, | 3231 | if (nla_parse_nested_deprecated(flags, NL80211_MNTR_FLAG_MAX, nla, mntr_flags_policy, NULL)) |
3225 | mntr_flags_policy, NULL)) | ||
3226 | return -EINVAL; | 3232 | return -EINVAL; |
3227 | 3233 | ||
3228 | for (flag = 1; flag <= NL80211_MNTR_FLAG_MAX; flag++) | 3234 | for (flag = 1; flag <= NL80211_MNTR_FLAG_MAX; flag++) |
@@ -4101,8 +4107,10 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info, | |||
4101 | sband = rdev->wiphy.bands[band]; | 4107 | sband = rdev->wiphy.bands[band]; |
4102 | if (sband == NULL) | 4108 | if (sband == NULL) |
4103 | return -EINVAL; | 4109 | return -EINVAL; |
4104 | err = nla_parse_nested(tb, NL80211_TXRATE_MAX, tx_rates, | 4110 | err = nla_parse_nested_deprecated(tb, NL80211_TXRATE_MAX, |
4105 | nl80211_txattr_policy, info->extack); | 4111 | tx_rates, |
4112 | nl80211_txattr_policy, | ||
4113 | info->extack); | ||
4106 | if (err) | 4114 | if (err) |
4107 | return err; | 4115 | return err; |
4108 | if (tb[NL80211_TXRATE_LEGACY]) { | 4116 | if (tb[NL80211_TXRATE_LEGACY]) { |
@@ -4270,9 +4278,10 @@ static int nl80211_parse_beacon(struct cfg80211_registered_device *rdev, | |||
4270 | if (attrs[NL80211_ATTR_FTM_RESPONDER]) { | 4278 | if (attrs[NL80211_ATTR_FTM_RESPONDER]) { |
4271 | struct nlattr *tb[NL80211_FTM_RESP_ATTR_MAX + 1]; | 4279 | struct nlattr *tb[NL80211_FTM_RESP_ATTR_MAX + 1]; |
4272 | 4280 | ||
4273 | err = nla_parse_nested(tb, NL80211_FTM_RESP_ATTR_MAX, | 4281 | err = nla_parse_nested_deprecated(tb, |
4274 | attrs[NL80211_ATTR_FTM_RESPONDER], | 4282 | NL80211_FTM_RESP_ATTR_MAX, |
4275 | NULL, NULL); | 4283 | attrs[NL80211_ATTR_FTM_RESPONDER], |
4284 | NULL, NULL); | ||
4276 | if (err) | 4285 | if (err) |
4277 | return err; | 4286 | return err; |
4278 | 4287 | ||
@@ -4680,8 +4689,7 @@ static int parse_station_flags(struct genl_info *info, | |||
4680 | if (!nla) | 4689 | if (!nla) |
4681 | return 0; | 4690 | return 0; |
4682 | 4691 | ||
4683 | if (nla_parse_nested(flags, NL80211_STA_FLAG_MAX, nla, | 4692 | if (nla_parse_nested_deprecated(flags, NL80211_STA_FLAG_MAX, nla, sta_flags_policy, info->extack)) |
4684 | sta_flags_policy, info->extack)) | ||
4685 | return -EINVAL; | 4693 | return -EINVAL; |
4686 | 4694 | ||
4687 | /* | 4695 | /* |
@@ -5350,8 +5358,9 @@ static int nl80211_parse_sta_wme(struct genl_info *info, | |||
5350 | return 0; | 5358 | return 0; |
5351 | 5359 | ||
5352 | nla = info->attrs[NL80211_ATTR_STA_WME]; | 5360 | nla = info->attrs[NL80211_ATTR_STA_WME]; |
5353 | err = nla_parse_nested(tb, NL80211_STA_WME_MAX, nla, | 5361 | err = nla_parse_nested_deprecated(tb, NL80211_STA_WME_MAX, nla, |
5354 | nl80211_sta_wme_policy, info->extack); | 5362 | nl80211_sta_wme_policy, |
5363 | info->extack); | ||
5355 | if (err) | 5364 | if (err) |
5356 | return err; | 5365 | return err; |
5357 | 5366 | ||
@@ -6491,9 +6500,7 @@ do { \ | |||
6491 | 6500 | ||
6492 | if (!info->attrs[NL80211_ATTR_MESH_CONFIG]) | 6501 | if (!info->attrs[NL80211_ATTR_MESH_CONFIG]) |
6493 | return -EINVAL; | 6502 | return -EINVAL; |
6494 | if (nla_parse_nested(tb, NL80211_MESHCONF_ATTR_MAX, | 6503 | if (nla_parse_nested_deprecated(tb, NL80211_MESHCONF_ATTR_MAX, info->attrs[NL80211_ATTR_MESH_CONFIG], nl80211_meshconf_params_policy, info->extack)) |
6495 | info->attrs[NL80211_ATTR_MESH_CONFIG], | ||
6496 | nl80211_meshconf_params_policy, info->extack)) | ||
6497 | return -EINVAL; | 6504 | return -EINVAL; |
6498 | 6505 | ||
6499 | /* This makes sure that there aren't more than 32 mesh config | 6506 | /* This makes sure that there aren't more than 32 mesh config |
@@ -6626,9 +6633,7 @@ static int nl80211_parse_mesh_setup(struct genl_info *info, | |||
6626 | 6633 | ||
6627 | if (!info->attrs[NL80211_ATTR_MESH_SETUP]) | 6634 | if (!info->attrs[NL80211_ATTR_MESH_SETUP]) |
6628 | return -EINVAL; | 6635 | return -EINVAL; |
6629 | if (nla_parse_nested(tb, NL80211_MESH_SETUP_ATTR_MAX, | 6636 | if (nla_parse_nested_deprecated(tb, NL80211_MESH_SETUP_ATTR_MAX, info->attrs[NL80211_ATTR_MESH_SETUP], nl80211_mesh_setup_params_policy, info->extack)) |
6630 | info->attrs[NL80211_ATTR_MESH_SETUP], | ||
6631 | nl80211_mesh_setup_params_policy, info->extack)) | ||
6632 | return -EINVAL; | 6637 | return -EINVAL; |
6633 | 6638 | ||
6634 | if (tb[NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC]) | 6639 | if (tb[NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC]) |
@@ -7012,9 +7017,9 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) | |||
7012 | 7017 | ||
7013 | nla_for_each_nested(nl_reg_rule, info->attrs[NL80211_ATTR_REG_RULES], | 7018 | nla_for_each_nested(nl_reg_rule, info->attrs[NL80211_ATTR_REG_RULES], |
7014 | rem_reg_rules) { | 7019 | rem_reg_rules) { |
7015 | r = nla_parse_nested(tb, NL80211_REG_RULE_ATTR_MAX, | 7020 | r = nla_parse_nested_deprecated(tb, NL80211_REG_RULE_ATTR_MAX, |
7016 | nl_reg_rule, reg_rule_policy, | 7021 | nl_reg_rule, reg_rule_policy, |
7017 | info->extack); | 7022 | info->extack); |
7018 | if (r) | 7023 | if (r) |
7019 | goto bad_reg; | 7024 | goto bad_reg; |
7020 | r = parse_reg_rule(tb, &rd->reg_rules[rule_idx]); | 7025 | r = parse_reg_rule(tb, &rd->reg_rules[rule_idx]); |
@@ -7085,8 +7090,9 @@ static int parse_bss_select(struct nlattr *nla, struct wiphy *wiphy, | |||
7085 | if (!nla_ok(nest, nla_len(nest))) | 7090 | if (!nla_ok(nest, nla_len(nest))) |
7086 | return -EINVAL; | 7091 | return -EINVAL; |
7087 | 7092 | ||
7088 | err = nla_parse_nested(attr, NL80211_BSS_SELECT_ATTR_MAX, nest, | 7093 | err = nla_parse_nested_deprecated(attr, NL80211_BSS_SELECT_ATTR_MAX, |
7089 | nl80211_bss_select_policy, NULL); | 7094 | nest, nl80211_bss_select_policy, |
7095 | NULL); | ||
7090 | if (err) | 7096 | if (err) |
7091 | return err; | 7097 | return err; |
7092 | 7098 | ||
@@ -7579,8 +7585,10 @@ nl80211_parse_sched_scan_plans(struct wiphy *wiphy, int n_plans, | |||
7579 | if (WARN_ON(i >= n_plans)) | 7585 | if (WARN_ON(i >= n_plans)) |
7580 | return -EINVAL; | 7586 | return -EINVAL; |
7581 | 7587 | ||
7582 | err = nla_parse_nested(plan, NL80211_SCHED_SCAN_PLAN_MAX, | 7588 | err = nla_parse_nested_deprecated(plan, |
7583 | attr, nl80211_plan_policy, NULL); | 7589 | NL80211_SCHED_SCAN_PLAN_MAX, |
7590 | attr, nl80211_plan_policy, | ||
7591 | NULL); | ||
7584 | if (err) | 7592 | if (err) |
7585 | return err; | 7593 | return err; |
7586 | 7594 | ||
@@ -7701,10 +7709,11 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, | |||
7701 | tmp) { | 7709 | tmp) { |
7702 | struct nlattr *rssi; | 7710 | struct nlattr *rssi; |
7703 | 7711 | ||
7704 | err = nla_parse_nested(tb, | 7712 | err = nla_parse_nested_deprecated(tb, |
7705 | NL80211_SCHED_SCAN_MATCH_ATTR_MAX, | 7713 | NL80211_SCHED_SCAN_MATCH_ATTR_MAX, |
7706 | attr, nl80211_match_policy, | 7714 | attr, |
7707 | NULL); | 7715 | nl80211_match_policy, |
7716 | NULL); | ||
7708 | if (err) | 7717 | if (err) |
7709 | return ERR_PTR(err); | 7718 | return ERR_PTR(err); |
7710 | 7719 | ||
@@ -7888,10 +7897,11 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, | |||
7888 | tmp) { | 7897 | tmp) { |
7889 | struct nlattr *ssid, *bssid, *rssi; | 7898 | struct nlattr *ssid, *bssid, *rssi; |
7890 | 7899 | ||
7891 | err = nla_parse_nested(tb, | 7900 | err = nla_parse_nested_deprecated(tb, |
7892 | NL80211_SCHED_SCAN_MATCH_ATTR_MAX, | 7901 | NL80211_SCHED_SCAN_MATCH_ATTR_MAX, |
7893 | attr, nl80211_match_policy, | 7902 | attr, |
7894 | NULL); | 7903 | nl80211_match_policy, |
7904 | NULL); | ||
7895 | if (err) | 7905 | if (err) |
7896 | goto out_free; | 7906 | goto out_free; |
7897 | ssid = tb[NL80211_SCHED_SCAN_MATCH_ATTR_SSID]; | 7907 | ssid = tb[NL80211_SCHED_SCAN_MATCH_ATTR_SSID]; |
@@ -8275,9 +8285,9 @@ static int nl80211_channel_switch(struct sk_buff *skb, struct genl_info *info) | |||
8275 | if (err) | 8285 | if (err) |
8276 | return err; | 8286 | return err; |
8277 | 8287 | ||
8278 | err = nla_parse_nested(csa_attrs, NL80211_ATTR_MAX, | 8288 | err = nla_parse_nested_deprecated(csa_attrs, NL80211_ATTR_MAX, |
8279 | info->attrs[NL80211_ATTR_CSA_IES], | 8289 | info->attrs[NL80211_ATTR_CSA_IES], |
8280 | nl80211_policy, info->extack); | 8290 | nl80211_policy, info->extack); |
8281 | if (err) | 8291 | if (err) |
8282 | return err; | 8292 | return err; |
8283 | 8293 | ||
@@ -9552,9 +9562,10 @@ static int nl80211_testmode_dump(struct sk_buff *skb, | |||
9552 | } else { | 9562 | } else { |
9553 | struct nlattr **attrbuf = genl_family_attrbuf(&nl80211_fam); | 9563 | struct nlattr **attrbuf = genl_family_attrbuf(&nl80211_fam); |
9554 | 9564 | ||
9555 | err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize, | 9565 | err = nlmsg_parse_deprecated(cb->nlh, |
9556 | attrbuf, nl80211_fam.maxattr, | 9566 | GENL_HDRLEN + nl80211_fam.hdrsize, |
9557 | nl80211_policy, NULL); | 9567 | attrbuf, nl80211_fam.maxattr, |
9568 | nl80211_policy, NULL); | ||
9558 | if (err) | 9569 | if (err) |
9559 | goto out_err; | 9570 | goto out_err; |
9560 | 9571 | ||
@@ -10678,8 +10689,9 @@ static int nl80211_set_cqm(struct sk_buff *skb, struct genl_info *info) | |||
10678 | if (!cqm) | 10689 | if (!cqm) |
10679 | return -EINVAL; | 10690 | return -EINVAL; |
10680 | 10691 | ||
10681 | err = nla_parse_nested(attrs, NL80211_ATTR_CQM_MAX, cqm, | 10692 | err = nla_parse_nested_deprecated(attrs, NL80211_ATTR_CQM_MAX, cqm, |
10682 | nl80211_attr_cqm_policy, info->extack); | 10693 | nl80211_attr_cqm_policy, |
10694 | info->extack); | ||
10683 | if (err) | 10695 | if (err) |
10684 | return err; | 10696 | return err; |
10685 | 10697 | ||
@@ -11117,8 +11129,8 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev, | |||
11117 | if (!rdev->wiphy.wowlan->tcp) | 11129 | if (!rdev->wiphy.wowlan->tcp) |
11118 | return -EINVAL; | 11130 | return -EINVAL; |
11119 | 11131 | ||
11120 | err = nla_parse_nested(tb, MAX_NL80211_WOWLAN_TCP, attr, | 11132 | err = nla_parse_nested_deprecated(tb, MAX_NL80211_WOWLAN_TCP, attr, |
11121 | nl80211_wowlan_tcp_policy, NULL); | 11133 | nl80211_wowlan_tcp_policy, NULL); |
11122 | if (err) | 11134 | if (err) |
11123 | return err; | 11135 | return err; |
11124 | 11136 | ||
@@ -11263,8 +11275,8 @@ static int nl80211_parse_wowlan_nd(struct cfg80211_registered_device *rdev, | |||
11263 | goto out; | 11275 | goto out; |
11264 | } | 11276 | } |
11265 | 11277 | ||
11266 | err = nla_parse_nested(tb, NL80211_ATTR_MAX, attr, nl80211_policy, | 11278 | err = nla_parse_nested_deprecated(tb, NL80211_ATTR_MAX, attr, |
11267 | NULL); | 11279 | nl80211_policy, NULL); |
11268 | if (err) | 11280 | if (err) |
11269 | goto out; | 11281 | goto out; |
11270 | 11282 | ||
@@ -11299,9 +11311,9 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info) | |||
11299 | goto set_wakeup; | 11311 | goto set_wakeup; |
11300 | } | 11312 | } |
11301 | 11313 | ||
11302 | err = nla_parse_nested(tb, MAX_NL80211_WOWLAN_TRIG, | 11314 | err = nla_parse_nested_deprecated(tb, MAX_NL80211_WOWLAN_TRIG, |
11303 | info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS], | 11315 | info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS], |
11304 | nl80211_wowlan_policy, info->extack); | 11316 | nl80211_wowlan_policy, info->extack); |
11305 | if (err) | 11317 | if (err) |
11306 | return err; | 11318 | return err; |
11307 | 11319 | ||
@@ -11383,9 +11395,11 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info) | |||
11383 | rem) { | 11395 | rem) { |
11384 | u8 *mask_pat; | 11396 | u8 *mask_pat; |
11385 | 11397 | ||
11386 | err = nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat, | 11398 | err = nla_parse_nested_deprecated(pat_tb, |
11387 | nl80211_packet_pattern_policy, | 11399 | MAX_NL80211_PKTPAT, |
11388 | info->extack); | 11400 | pat, |
11401 | nl80211_packet_pattern_policy, | ||
11402 | info->extack); | ||
11389 | if (err) | 11403 | if (err) |
11390 | goto error; | 11404 | goto error; |
11391 | 11405 | ||
@@ -11598,8 +11612,8 @@ static int nl80211_parse_coalesce_rule(struct cfg80211_registered_device *rdev, | |||
11598 | int rem, pat_len, mask_len, pkt_offset, n_patterns = 0; | 11612 | int rem, pat_len, mask_len, pkt_offset, n_patterns = 0; |
11599 | struct nlattr *pat_tb[NUM_NL80211_PKTPAT]; | 11613 | struct nlattr *pat_tb[NUM_NL80211_PKTPAT]; |
11600 | 11614 | ||
11601 | err = nla_parse_nested(tb, NL80211_ATTR_COALESCE_RULE_MAX, rule, | 11615 | err = nla_parse_nested_deprecated(tb, NL80211_ATTR_COALESCE_RULE_MAX, |
11602 | nl80211_coalesce_policy, NULL); | 11616 | rule, nl80211_coalesce_policy, NULL); |
11603 | if (err) | 11617 | if (err) |
11604 | return err; | 11618 | return err; |
11605 | 11619 | ||
@@ -11634,8 +11648,10 @@ static int nl80211_parse_coalesce_rule(struct cfg80211_registered_device *rdev, | |||
11634 | rem) { | 11648 | rem) { |
11635 | u8 *mask_pat; | 11649 | u8 *mask_pat; |
11636 | 11650 | ||
11637 | err = nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat, | 11651 | err = nla_parse_nested_deprecated(pat_tb, MAX_NL80211_PKTPAT, |
11638 | nl80211_packet_pattern_policy, NULL); | 11652 | pat, |
11653 | nl80211_packet_pattern_policy, | ||
11654 | NULL); | ||
11639 | if (err) | 11655 | if (err) |
11640 | return err; | 11656 | return err; |
11641 | 11657 | ||
@@ -11757,9 +11773,9 @@ static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info) | |||
11757 | if (!info->attrs[NL80211_ATTR_REKEY_DATA]) | 11773 | if (!info->attrs[NL80211_ATTR_REKEY_DATA]) |
11758 | return -EINVAL; | 11774 | return -EINVAL; |
11759 | 11775 | ||
11760 | err = nla_parse_nested(tb, MAX_NL80211_REKEY_DATA, | 11776 | err = nla_parse_nested_deprecated(tb, MAX_NL80211_REKEY_DATA, |
11761 | info->attrs[NL80211_ATTR_REKEY_DATA], | 11777 | info->attrs[NL80211_ATTR_REKEY_DATA], |
11762 | nl80211_rekey_policy, info->extack); | 11778 | nl80211_rekey_policy, info->extack); |
11763 | if (err) | 11779 | if (err) |
11764 | return err; | 11780 | return err; |
11765 | 11781 | ||
@@ -12071,9 +12087,10 @@ static int nl80211_nan_add_func(struct sk_buff *skb, | |||
12071 | if (!info->attrs[NL80211_ATTR_NAN_FUNC]) | 12087 | if (!info->attrs[NL80211_ATTR_NAN_FUNC]) |
12072 | return -EINVAL; | 12088 | return -EINVAL; |
12073 | 12089 | ||
12074 | err = nla_parse_nested(tb, NL80211_NAN_FUNC_ATTR_MAX, | 12090 | err = nla_parse_nested_deprecated(tb, NL80211_NAN_FUNC_ATTR_MAX, |
12075 | info->attrs[NL80211_ATTR_NAN_FUNC], | 12091 | info->attrs[NL80211_ATTR_NAN_FUNC], |
12076 | nl80211_nan_func_policy, info->extack); | 12092 | nl80211_nan_func_policy, |
12093 | info->extack); | ||
12077 | if (err) | 12094 | if (err) |
12078 | return err; | 12095 | return err; |
12079 | 12096 | ||
@@ -12169,9 +12186,11 @@ static int nl80211_nan_add_func(struct sk_buff *skb, | |||
12169 | if (tb[NL80211_NAN_FUNC_SRF]) { | 12186 | if (tb[NL80211_NAN_FUNC_SRF]) { |
12170 | struct nlattr *srf_tb[NUM_NL80211_NAN_SRF_ATTR]; | 12187 | struct nlattr *srf_tb[NUM_NL80211_NAN_SRF_ATTR]; |
12171 | 12188 | ||
12172 | err = nla_parse_nested(srf_tb, NL80211_NAN_SRF_ATTR_MAX, | 12189 | err = nla_parse_nested_deprecated(srf_tb, |
12173 | tb[NL80211_NAN_FUNC_SRF], | 12190 | NL80211_NAN_SRF_ATTR_MAX, |
12174 | nl80211_nan_srf_policy, info->extack); | 12191 | tb[NL80211_NAN_FUNC_SRF], |
12192 | nl80211_nan_srf_policy, | ||
12193 | info->extack); | ||
12175 | if (err) | 12194 | if (err) |
12176 | goto out; | 12195 | goto out; |
12177 | 12196 | ||
@@ -12704,8 +12723,10 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb, | |||
12704 | return 0; | 12723 | return 0; |
12705 | } | 12724 | } |
12706 | 12725 | ||
12707 | err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize, attrbuf, | 12726 | err = nlmsg_parse_deprecated(cb->nlh, |
12708 | nl80211_fam.maxattr, nl80211_policy, NULL); | 12727 | GENL_HDRLEN + nl80211_fam.hdrsize, |
12728 | attrbuf, nl80211_fam.maxattr, | ||
12729 | nl80211_policy, NULL); | ||
12709 | if (err) | 12730 | if (err) |
12710 | return err; | 12731 | return err; |
12711 | 12732 | ||
diff --git a/net/wireless/pmsr.c b/net/wireless/pmsr.c index 5c80bccc8b3c..1b190475359a 100644 --- a/net/wireless/pmsr.c +++ b/net/wireless/pmsr.c | |||
@@ -25,7 +25,8 @@ static int pmsr_parse_ftm(struct cfg80211_registered_device *rdev, | |||
25 | } | 25 | } |
26 | 26 | ||
27 | /* no validation needed - was already done via nested policy */ | 27 | /* no validation needed - was already done via nested policy */ |
28 | nla_parse_nested(tb, NL80211_PMSR_FTM_REQ_ATTR_MAX, ftmreq, NULL, NULL); | 28 | nla_parse_nested_deprecated(tb, NL80211_PMSR_FTM_REQ_ATTR_MAX, ftmreq, |
29 | NULL, NULL); | ||
29 | 30 | ||
30 | if (tb[NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE]) | 31 | if (tb[NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE]) |
31 | preamble = nla_get_u32(tb[NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE]); | 32 | preamble = nla_get_u32(tb[NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE]); |
@@ -139,7 +140,8 @@ static int pmsr_parse_peer(struct cfg80211_registered_device *rdev, | |||
139 | int err, rem; | 140 | int err, rem; |
140 | 141 | ||
141 | /* no validation needed - was already done via nested policy */ | 142 | /* no validation needed - was already done via nested policy */ |
142 | nla_parse_nested(tb, NL80211_PMSR_PEER_ATTR_MAX, peer, NULL, NULL); | 143 | nla_parse_nested_deprecated(tb, NL80211_PMSR_PEER_ATTR_MAX, peer, |
144 | NULL, NULL); | ||
143 | 145 | ||
144 | if (!tb[NL80211_PMSR_PEER_ATTR_ADDR] || | 146 | if (!tb[NL80211_PMSR_PEER_ATTR_ADDR] || |
145 | !tb[NL80211_PMSR_PEER_ATTR_CHAN] || | 147 | !tb[NL80211_PMSR_PEER_ATTR_CHAN] || |
@@ -154,9 +156,9 @@ static int pmsr_parse_peer(struct cfg80211_registered_device *rdev, | |||
154 | /* reuse info->attrs */ | 156 | /* reuse info->attrs */ |
155 | memset(info->attrs, 0, sizeof(*info->attrs) * (NL80211_ATTR_MAX + 1)); | 157 | memset(info->attrs, 0, sizeof(*info->attrs) * (NL80211_ATTR_MAX + 1)); |
156 | /* need to validate here, we don't want to have validation recursion */ | 158 | /* need to validate here, we don't want to have validation recursion */ |
157 | err = nla_parse_nested(info->attrs, NL80211_ATTR_MAX, | 159 | err = nla_parse_nested_deprecated(info->attrs, NL80211_ATTR_MAX, |
158 | tb[NL80211_PMSR_PEER_ATTR_CHAN], | 160 | tb[NL80211_PMSR_PEER_ATTR_CHAN], |
159 | nl80211_policy, info->extack); | 161 | nl80211_policy, info->extack); |
160 | if (err) | 162 | if (err) |
161 | return err; | 163 | return err; |
162 | 164 | ||
@@ -165,9 +167,9 @@ static int pmsr_parse_peer(struct cfg80211_registered_device *rdev, | |||
165 | return err; | 167 | return err; |
166 | 168 | ||
167 | /* no validation needed - was already done via nested policy */ | 169 | /* no validation needed - was already done via nested policy */ |
168 | nla_parse_nested(req, NL80211_PMSR_REQ_ATTR_MAX, | 170 | nla_parse_nested_deprecated(req, NL80211_PMSR_REQ_ATTR_MAX, |
169 | tb[NL80211_PMSR_PEER_ATTR_REQ], | 171 | tb[NL80211_PMSR_PEER_ATTR_REQ], NULL, |
170 | NULL, NULL); | 172 | NULL); |
171 | 173 | ||
172 | if (!req[NL80211_PMSR_REQ_ATTR_DATA]) { | 174 | if (!req[NL80211_PMSR_REQ_ATTR_DATA]) { |
173 | NL_SET_ERR_MSG_ATTR(info->extack, | 175 | NL_SET_ERR_MSG_ATTR(info->extack, |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index a131f9ff979e..d7cb16f0df5b 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -1006,8 +1006,8 @@ static int xfrm_dump_sa(struct sk_buff *skb, struct netlink_callback *cb) | |||
1006 | u8 proto = 0; | 1006 | u8 proto = 0; |
1007 | int err; | 1007 | int err; |
1008 | 1008 | ||
1009 | err = nlmsg_parse(cb->nlh, 0, attrs, XFRMA_MAX, xfrma_policy, | 1009 | err = nlmsg_parse_deprecated(cb->nlh, 0, attrs, XFRMA_MAX, |
1010 | cb->extack); | 1010 | xfrma_policy, cb->extack); |
1011 | if (err < 0) | 1011 | if (err < 0) |
1012 | return err; | 1012 | return err; |
1013 | 1013 | ||
@@ -2656,9 +2656,9 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
2656 | } | 2656 | } |
2657 | } | 2657 | } |
2658 | 2658 | ||
2659 | err = nlmsg_parse(nlh, xfrm_msg_min[type], attrs, | 2659 | err = nlmsg_parse_deprecated(nlh, xfrm_msg_min[type], attrs, |
2660 | link->nla_max ? : XFRMA_MAX, | 2660 | link->nla_max ? : XFRMA_MAX, |
2661 | link->nla_pol ? : xfrma_policy, extack); | 2661 | link->nla_pol ? : xfrma_policy, extack); |
2662 | if (err < 0) | 2662 | if (err < 0) |
2663 | return err; | 2663 | return err; |
2664 | 2664 | ||