Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netlink: make validation more configurable for future strictness

We currently have two levels of strict validation:

1) liberal (default)
- undefined (type >= max) & NLA_UNSPEC attributes accepted
- attribute length >= expected accepted
- garbage at end of message accepted
2) strict (opt-in)
- NLA_UNSPEC attributes accepted
- attribute length >= expected accepted

Split out parsing strictness into four different options:
* TRAILING - check that there's no trailing data after parsing
attributes (in message or nested)
* MAXTYPE - reject attrs > max known type
* UNSPEC - reject attributes with NLA_UNSPEC policy entries
* STRICT_ATTRS - strictly validate attribute size

The default for future things should be *everything*.
The current *_strict() is a combination of TRAILING and MAXTYPE,
and is renamed to _deprecated_strict().
The current regular parsing has none of this, and is renamed to
*_parse_deprecated().

Additionally it allows us to selectively set one of the new flags
even on old policies. Notably, the UNSPEC flag could be useful in
this case, since it can be arranged (by filling in the policy) to
not be an incompatible userspace ABI change, but would then going
forward prevent forgetting attribute entries. Similar can apply
to the POLICY flag.

We end up with the following renames:
* nla_parse -> nla_parse_deprecated
* nla_parse_strict -> nla_parse_deprecated_strict
* nlmsg_parse -> nlmsg_parse_deprecated
* nlmsg_parse_strict -> nlmsg_parse_deprecated_strict
* nla_parse_nested -> nla_parse_nested_deprecated
* nla_validate_nested -> nla_validate_nested_deprecated

Using spatch, of course:
@@
expression TB, MAX, HEAD, LEN, POL, EXT;
@@
-nla_parse(TB, MAX, HEAD, LEN, POL, EXT)
+nla_parse_deprecated(TB, MAX, HEAD, LEN, POL, EXT)

@@
expression NLH, HDRLEN, TB, MAX, POL, EXT;
@@
-nlmsg_parse(NLH, HDRLEN, TB, MAX, POL, EXT)
+nlmsg_parse_deprecated(NLH, HDRLEN, TB, MAX, POL, EXT)

@@
expression NLH, HDRLEN, TB, MAX, POL, EXT;
@@
-nlmsg_parse_strict(NLH, HDRLEN, TB, MAX, POL, EXT)
+nlmsg_parse_deprecated_strict(NLH, HDRLEN, TB, MAX, POL, EXT)

@@
expression TB, MAX, NLA, POL, EXT;
@@
-nla_parse_nested(TB, MAX, NLA, POL, EXT)
+nla_parse_nested_deprecated(TB, MAX, NLA, POL, EXT)

@@
expression START, MAX, POL, EXT;
@@
-nla_validate_nested(START, MAX, POL, EXT)
+nla_validate_nested_deprecated(START, MAX, POL, EXT)

@@
expression NLH, HDRLEN, MAX, POL, EXT;
@@
-nlmsg_validate(NLH, HDRLEN, MAX, POL, EXT)
+nlmsg_validate_deprecated(NLH, HDRLEN, MAX, POL, EXT)

For this patch, don't actually add the strict, non-renamed versions
yet so that it breaks compile if I get it wrong.

Also, while at it, make nla_validate and nla_parse go down to a
common __nla_validate_parse() function to avoid code duplication.

Ultimately, this allows us to have very strict validation for every
new caller of nla_parse()/nlmsg_parse() etc as re-introduced in the
next patch, while existing things will continue to work as is.

In effect then, this adds fully strict validation for any new command.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Johannes Berg and committed by
David S. Miller
8cb08174 6f455f5f

+1243 -943
+2 -2
crypto/crypto_user_base.c
··· 465 465 return err; 466 466 } 467 467 468 - err = nlmsg_parse(nlh, crypto_msg_min[type], attrs, CRYPTOCFGA_MAX, 469 - crypto_policy, extack); 468 + err = nlmsg_parse_deprecated(nlh, crypto_msg_min[type], attrs, 469 + CRYPTOCFGA_MAX, crypto_policy, extack); 470 470 if (err < 0) 471 471 return err; 472 472
+2 -1
drivers/block/drbd/drbd_nla.c
··· 35 35 36 36 err = drbd_nla_check_mandatory(maxtype, nla); 37 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 41 return err; 41 42 }
+8 -4
drivers/block/nbd.c
··· 1797 1797 ret = -EINVAL; 1798 1798 goto out; 1799 1799 } 1800 - ret = nla_parse_nested(socks, NBD_SOCK_MAX, attr, 1801 - nbd_sock_policy, info->extack); 1800 + ret = nla_parse_nested_deprecated(socks, NBD_SOCK_MAX, 1801 + attr, 1802 + nbd_sock_policy, 1803 + info->extack); 1802 1804 if (ret != 0) { 1803 1805 printk(KERN_ERR "nbd: error processing sock list\n"); 1804 1806 ret = -EINVAL; ··· 1970 1968 ret = -EINVAL; 1971 1969 goto out; 1972 1970 } 1973 - ret = nla_parse_nested(socks, NBD_SOCK_MAX, attr, 1974 - nbd_sock_policy, info->extack); 1971 + ret = nla_parse_nested_deprecated(socks, NBD_SOCK_MAX, 1972 + attr, 1973 + nbd_sock_policy, 1974 + info->extack); 1975 1975 if (ret != 0) { 1976 1976 printk(KERN_ERR "nbd: error processing sock list\n"); 1977 1977 ret = -EINVAL;
+2 -2
drivers/infiniband/core/addr.c
··· 86 86 if (nlh->nlmsg_flags & RDMA_NL_LS_F_ERR) 87 87 return false; 88 88 89 - ret = nla_parse(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh), 90 - nlmsg_len(nlh), ib_nl_addr_policy, NULL); 89 + ret = nla_parse_deprecated(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh), 90 + nlmsg_len(nlh), ib_nl_addr_policy, NULL); 91 91 if (ret) 92 92 return false; 93 93
+4 -4
drivers/infiniband/core/iwpm_util.c
··· 506 506 int ret; 507 507 const char *err_str = ""; 508 508 509 - ret = nlmsg_validate(cb->nlh, nlh_len, policy_max - 1, nlmsg_policy, 510 - NULL); 509 + ret = nlmsg_validate_deprecated(cb->nlh, nlh_len, policy_max - 1, 510 + nlmsg_policy, NULL); 511 511 if (ret) { 512 512 err_str = "Invalid attribute"; 513 513 goto parse_nlmsg_error; 514 514 } 515 - ret = nlmsg_parse(cb->nlh, nlh_len, nltb, policy_max - 1, 516 - nlmsg_policy, NULL); 515 + ret = nlmsg_parse_deprecated(cb->nlh, nlh_len, nltb, policy_max - 1, 516 + nlmsg_policy, NULL); 517 517 if (ret) { 518 518 err_str = "Unable to parse the nlmsg"; 519 519 goto parse_nlmsg_error;
+18 -18
drivers/infiniband/core/nldev.c
··· 608 608 u32 index; 609 609 int err; 610 610 611 - err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 612 - nldev_policy, extack); 611 + err = nlmsg_parse_deprecated(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 612 + nldev_policy, extack); 613 613 if (err || !tb[RDMA_NLDEV_ATTR_DEV_INDEX]) 614 614 return -EINVAL; 615 615 ··· 653 653 u32 index; 654 654 int err; 655 655 656 - err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, nldev_policy, 657 - extack); 656 + err = nlmsg_parse_deprecated(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 657 + nldev_policy, extack); 658 658 if (err || !tb[RDMA_NLDEV_ATTR_DEV_INDEX]) 659 659 return -EINVAL; 660 660 ··· 722 722 u32 port; 723 723 int err; 724 724 725 - err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 726 - nldev_policy, extack); 725 + err = nlmsg_parse_deprecated(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 726 + nldev_policy, extack); 727 727 if (err || 728 728 !tb[RDMA_NLDEV_ATTR_DEV_INDEX] || 729 729 !tb[RDMA_NLDEV_ATTR_PORT_INDEX]) ··· 778 778 int err; 779 779 unsigned int p; 780 780 781 - err = nlmsg_parse(cb->nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 782 - nldev_policy, NULL); 781 + err = nlmsg_parse_deprecated(cb->nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 782 + nldev_policy, NULL); 783 783 if (err || !tb[RDMA_NLDEV_ATTR_DEV_INDEX]) 784 784 return -EINVAL; 785 785 ··· 833 833 u32 index; 834 834 int ret; 835 835 836 - ret = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 837 - nldev_policy, extack); 836 + ret = nlmsg_parse_deprecated(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 837 + nldev_policy, extack); 838 838 if (ret || !tb[RDMA_NLDEV_ATTR_DEV_INDEX]) 839 839 return -EINVAL; 840 840 ··· 982 982 struct sk_buff *msg; 983 983 int ret; 984 984 985 - ret = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 986 - nldev_policy, extack); 985 + ret = nlmsg_parse_deprecated(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 986 + nldev_policy, extack); 987 987 if (ret || !tb[RDMA_NLDEV_ATTR_DEV_INDEX] || !fe->id || !tb[fe->id]) 988 988 return -EINVAL; 989 989 ··· 1071 1071 u32 index, port = 0; 1072 1072 bool filled = false; 1073 1073 1074 - err = nlmsg_parse(cb->nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 1075 - nldev_policy, NULL); 1074 + err = nlmsg_parse_deprecated(cb->nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 1075 + nldev_policy, NULL); 1076 1076 /* 1077 1077 * Right now, we are expecting the device index to get res information, 1078 1078 * but it is possible to extend this code to return all devices in ··· 1250 1250 char type[IFNAMSIZ]; 1251 1251 int err; 1252 1252 1253 - err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 1254 - nldev_policy, extack); 1253 + err = nlmsg_parse_deprecated(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 1254 + nldev_policy, extack); 1255 1255 if (err || !tb[RDMA_NLDEV_ATTR_DEV_NAME] || 1256 1256 !tb[RDMA_NLDEV_ATTR_LINK_TYPE] || !tb[RDMA_NLDEV_ATTR_NDEV_NAME]) 1257 1257 return -EINVAL; ··· 1294 1294 u32 index; 1295 1295 int err; 1296 1296 1297 - err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 1298 - nldev_policy, extack); 1297 + err = nlmsg_parse_deprecated(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 1298 + nldev_policy, extack); 1299 1299 if (err || !tb[RDMA_NLDEV_ATTR_DEV_INDEX]) 1300 1300 return -EINVAL; 1301 1301
+4 -4
drivers/infiniband/core/sa_query.c
··· 1028 1028 !(NETLINK_CB(skb).sk)) 1029 1029 return -EPERM; 1030 1030 1031 - ret = nla_parse(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh), 1032 - nlmsg_len(nlh), ib_nl_policy, NULL); 1031 + ret = nla_parse_deprecated(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh), 1032 + nlmsg_len(nlh), ib_nl_policy, NULL); 1033 1033 attr = (const struct nlattr *)tb[LS_NLA_TYPE_TIMEOUT]; 1034 1034 if (ret || !attr) 1035 1035 goto settimeout_out; ··· 1080 1080 if (nlh->nlmsg_flags & RDMA_NL_LS_F_ERR) 1081 1081 return 0; 1082 1082 1083 - ret = nla_parse(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh), 1084 - nlmsg_len(nlh), ib_nl_policy, NULL); 1083 + ret = nla_parse_deprecated(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh), 1084 + nlmsg_len(nlh), ib_nl_policy, NULL); 1085 1085 if (ret) 1086 1086 return 0; 1087 1087
+3 -9
drivers/net/ieee802154/mac802154_hwsim.c
··· 430 430 !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE]) 431 431 return -EINVAL; 432 432 433 - if (nla_parse_nested(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX, 434 - info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE], 435 - hwsim_edge_policy, NULL)) 433 + if (nla_parse_nested_deprecated(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX, info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE], hwsim_edge_policy, NULL)) 436 434 return -EINVAL; 437 435 438 436 if (!edge_attrs[MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID]) ··· 492 494 !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE]) 493 495 return -EINVAL; 494 496 495 - if (nla_parse_nested(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX, 496 - info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE], 497 - hwsim_edge_policy, NULL)) 497 + if (nla_parse_nested_deprecated(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX, info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE], hwsim_edge_policy, NULL)) 498 498 return -EINVAL; 499 499 500 500 if (!edge_attrs[MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID]) ··· 540 544 !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE]) 541 545 return -EINVAL; 542 546 543 - if (nla_parse_nested(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX, 544 - info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE], 545 - hwsim_edge_policy, NULL)) 547 + if (nla_parse_nested_deprecated(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX, info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE], hwsim_edge_policy, NULL)) 546 548 return -EINVAL; 547 549 548 550 if (!edge_attrs[MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID] &&
+2 -6
drivers/net/macsec.c
··· 1611 1611 if (!attrs[MACSEC_ATTR_SA_CONFIG]) 1612 1612 return -EINVAL; 1613 1613 1614 - if (nla_parse_nested(tb_sa, MACSEC_SA_ATTR_MAX, 1615 - attrs[MACSEC_ATTR_SA_CONFIG], 1616 - macsec_genl_sa_policy, NULL)) 1614 + if (nla_parse_nested_deprecated(tb_sa, MACSEC_SA_ATTR_MAX, attrs[MACSEC_ATTR_SA_CONFIG], macsec_genl_sa_policy, NULL)) 1617 1615 return -EINVAL; 1618 1616 1619 1617 return 0; ··· 1622 1624 if (!attrs[MACSEC_ATTR_RXSC_CONFIG]) 1623 1625 return -EINVAL; 1624 1626 1625 - if (nla_parse_nested(tb_rxsc, MACSEC_RXSC_ATTR_MAX, 1626 - attrs[MACSEC_ATTR_RXSC_CONFIG], 1627 - macsec_genl_rxsc_policy, NULL)) 1627 + if (nla_parse_nested_deprecated(tb_rxsc, MACSEC_RXSC_ATTR_MAX, attrs[MACSEC_ATTR_RXSC_CONFIG], macsec_genl_rxsc_policy, NULL)) 1628 1628 return -EINVAL; 1629 1629 1630 1630 return 0;
+5 -3
drivers/net/team/team.c
··· 2510 2510 err = -EINVAL; 2511 2511 goto team_put; 2512 2512 } 2513 - err = nla_parse_nested(opt_attrs, TEAM_ATTR_OPTION_MAX, 2514 - nl_option, team_nl_option_policy, 2515 - info->extack); 2513 + err = nla_parse_nested_deprecated(opt_attrs, 2514 + TEAM_ATTR_OPTION_MAX, 2515 + nl_option, 2516 + team_nl_option_policy, 2517 + info->extack); 2516 2518 if (err) 2517 2519 goto team_put; 2518 2520 if (!opt_attrs[TEAM_ATTR_OPTION_NAME] ||
+2 -2
drivers/net/wireless/ath/ath10k/testmode.c
··· 416 416 struct nlattr *tb[ATH10K_TM_ATTR_MAX + 1]; 417 417 int ret; 418 418 419 - ret = nla_parse(tb, ATH10K_TM_ATTR_MAX, data, len, ath10k_tm_policy, 420 - NULL); 419 + ret = nla_parse_deprecated(tb, ATH10K_TM_ATTR_MAX, data, len, 420 + ath10k_tm_policy, NULL); 421 421 if (ret) 422 422 return ret; 423 423
+2 -2
drivers/net/wireless/ath/ath6kl/testmode.c
··· 74 74 int err, buf_len; 75 75 void *buf; 76 76 77 - err = nla_parse(tb, ATH6KL_TM_ATTR_MAX, data, len, ath6kl_tm_policy, 78 - NULL); 77 + err = nla_parse_deprecated(tb, ATH6KL_TM_ATTR_MAX, data, len, 78 + ath6kl_tm_policy, NULL); 79 79 if (err) 80 80 return err; 81 81
+2 -2
drivers/net/wireless/ath/wcn36xx/testmode.c
··· 132 132 unsigned short attr; 133 133 134 134 wcn36xx_dbg_dump(WCN36XX_DBG_TESTMODE_DUMP, "Data:", data, len); 135 - ret = nla_parse(tb, WCN36XX_TM_ATTR_MAX, data, len, 136 - wcn36xx_tm_policy, NULL); 135 + ret = nla_parse_deprecated(tb, WCN36XX_TM_ATTR_MAX, data, len, 136 + wcn36xx_tm_policy, NULL); 137 137 if (ret) 138 138 return ret; 139 139
+13 -11
drivers/net/wireless/ath/wil6210/cfg80211.c
··· 2620 2620 if (!test_bit(WMI_FW_CAPABILITY_RF_SECTORS, wil->fw_capabilities)) 2621 2621 return -EOPNOTSUPP; 2622 2622 2623 - rc = nla_parse(tb, QCA_ATTR_DMG_RF_SECTOR_MAX, data, data_len, 2624 - wil_rf_sector_policy, NULL); 2623 + rc = nla_parse_deprecated(tb, QCA_ATTR_DMG_RF_SECTOR_MAX, data, 2624 + data_len, wil_rf_sector_policy, NULL); 2625 2625 if (rc) { 2626 2626 wil_err(wil, "Invalid rf sector ATTR\n"); 2627 2627 return rc; ··· 2740 2740 if (!test_bit(WMI_FW_CAPABILITY_RF_SECTORS, wil->fw_capabilities)) 2741 2741 return -EOPNOTSUPP; 2742 2742 2743 - rc = nla_parse(tb, QCA_ATTR_DMG_RF_SECTOR_MAX, data, data_len, 2744 - wil_rf_sector_policy, NULL); 2743 + rc = nla_parse_deprecated(tb, QCA_ATTR_DMG_RF_SECTOR_MAX, data, 2744 + data_len, wil_rf_sector_policy, NULL); 2745 2745 if (rc) { 2746 2746 wil_err(wil, "Invalid rf sector ATTR\n"); 2747 2747 return rc; ··· 2773 2773 cmd.sector_type = sector_type; 2774 2774 nla_for_each_nested(nl_cfg, tb[QCA_ATTR_DMG_RF_SECTOR_CFG], 2775 2775 tmp) { 2776 - rc = nla_parse_nested(tb2, QCA_ATTR_DMG_RF_SECTOR_CFG_MAX, 2777 - nl_cfg, wil_rf_sector_cfg_policy, 2778 - NULL); 2776 + rc = nla_parse_nested_deprecated(tb2, 2777 + QCA_ATTR_DMG_RF_SECTOR_CFG_MAX, 2778 + nl_cfg, 2779 + wil_rf_sector_cfg_policy, 2780 + NULL); 2779 2781 if (rc) { 2780 2782 wil_err(wil, "invalid sector cfg\n"); 2781 2783 return -EINVAL; ··· 2849 2847 if (!test_bit(WMI_FW_CAPABILITY_RF_SECTORS, wil->fw_capabilities)) 2850 2848 return -EOPNOTSUPP; 2851 2849 2852 - rc = nla_parse(tb, QCA_ATTR_DMG_RF_SECTOR_MAX, data, data_len, 2853 - wil_rf_sector_policy, NULL); 2850 + rc = nla_parse_deprecated(tb, QCA_ATTR_DMG_RF_SECTOR_MAX, data, 2851 + data_len, wil_rf_sector_policy, NULL); 2854 2852 if (rc) { 2855 2853 wil_err(wil, "Invalid rf sector ATTR\n"); 2856 2854 return rc; ··· 2957 2955 if (!test_bit(WMI_FW_CAPABILITY_RF_SECTORS, wil->fw_capabilities)) 2958 2956 return -EOPNOTSUPP; 2959 2957 2960 - rc = nla_parse(tb, QCA_ATTR_DMG_RF_SECTOR_MAX, data, data_len, 2961 - wil_rf_sector_policy, NULL); 2958 + rc = nla_parse_deprecated(tb, QCA_ATTR_DMG_RF_SECTOR_MAX, data, 2959 + data_len, wil_rf_sector_policy, NULL); 2962 2960 if (rc) { 2963 2961 wil_err(wil, "Invalid rf sector ATTR\n"); 2964 2962 return rc;
+2 -2
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
··· 4465 4465 int err; 4466 4466 u32 noa_duration; 4467 4467 4468 - err = nla_parse(tb, IWL_MVM_TM_ATTR_MAX, data, len, iwl_mvm_tm_policy, 4469 - NULL); 4468 + err = nla_parse_deprecated(tb, IWL_MVM_TM_ATTR_MAX, data, len, 4469 + iwl_mvm_tm_policy, NULL); 4470 4470 if (err) 4471 4471 return err; 4472 4472
+4 -4
drivers/net/wireless/mac80211_hwsim.c
··· 409 409 int err; 410 410 u32 val; 411 411 412 - err = nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, data, data_len, 413 - hwsim_vendor_test_policy, NULL); 412 + err = nla_parse_deprecated(tb, QCA_WLAN_VENDOR_ATTR_MAX, data, 413 + data_len, hwsim_vendor_test_policy, NULL); 414 414 if (err) 415 415 return err; 416 416 if (!tb[QCA_WLAN_VENDOR_ATTR_TEST]) ··· 1936 1936 struct sk_buff *skb; 1937 1937 int err, ps; 1938 1938 1939 - err = nla_parse(tb, HWSIM_TM_ATTR_MAX, data, len, 1940 - hwsim_testmode_policy, NULL); 1939 + err = nla_parse_deprecated(tb, HWSIM_TM_ATTR_MAX, data, len, 1940 + hwsim_testmode_policy, NULL); 1941 1941 if (err) 1942 1942 return err; 1943 1943
+2 -2
drivers/net/wireless/marvell/mwifiex/cfg80211.c
··· 4059 4059 if (!priv) 4060 4060 return -EINVAL; 4061 4061 4062 - err = nla_parse(tb, MWIFIEX_TM_ATTR_MAX, data, len, mwifiex_tm_policy, 4063 - NULL); 4062 + err = nla_parse_deprecated(tb, MWIFIEX_TM_ATTR_MAX, data, len, 4063 + mwifiex_tm_policy, NULL); 4064 4064 if (err) 4065 4065 return err; 4066 4066
+2 -2
drivers/net/wireless/ti/wlcore/testmode.c
··· 372 372 u32 nla_cmd; 373 373 int err; 374 374 375 - err = nla_parse(tb, WL1271_TM_ATTR_MAX, data, len, wl1271_tm_policy, 376 - NULL); 375 + err = nla_parse_deprecated(tb, WL1271_TM_ATTR_MAX, data, len, 376 + wl1271_tm_policy, NULL); 377 377 if (err) 378 378 return err; 379 379
+4 -4
drivers/net/wireless/ti/wlcore/vendor_cmd.c
··· 41 41 if (!data) 42 42 return -EINVAL; 43 43 44 - ret = nla_parse(tb, MAX_WLCORE_VENDOR_ATTR, data, data_len, 45 - wlcore_vendor_attr_policy, NULL); 44 + ret = nla_parse_deprecated(tb, MAX_WLCORE_VENDOR_ATTR, data, data_len, 45 + wlcore_vendor_attr_policy, NULL); 46 46 if (ret) 47 47 return ret; 48 48 ··· 122 122 if (!data) 123 123 return -EINVAL; 124 124 125 - ret = nla_parse(tb, MAX_WLCORE_VENDOR_ATTR, data, data_len, 126 - wlcore_vendor_attr_policy, NULL); 125 + ret = nla_parse_deprecated(tb, MAX_WLCORE_VENDOR_ATTR, data, data_len, 126 + wlcore_vendor_attr_policy, NULL); 127 127 if (ret) 128 128 return ret; 129 129
+8 -8
include/net/genetlink.h
··· 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 169 * @nlh: netlink message header 170 170 * @family: genetlink message family 171 171 * @tb: destination array with maxtype+1 elements ··· 173 173 * @policy: validation policy 174 174 * @extack: extended ACK report struct 175 175 */ 176 - static inline int genlmsg_parse(const struct nlmsghdr *nlh, 177 - const struct genl_family *family, 178 - struct nlattr *tb[], int maxtype, 179 - const struct nla_policy *policy, 180 - struct netlink_ext_ack *extack) 176 + static inline int genlmsg_parse_deprecated(const struct nlmsghdr *nlh, 177 + const struct genl_family *family, 178 + struct nlattr *tb[], int maxtype, 179 + const struct nla_policy *policy, 180 + struct netlink_ext_ack *extack) 181 181 { 182 - return nlmsg_parse(nlh, family->hdrsize + GENL_HDRLEN, tb, maxtype, 183 - policy, extack); 182 + return __nlmsg_parse(nlh, family->hdrsize + GENL_HDRLEN, tb, maxtype, 183 + policy, NL_VALIDATE_LIBERAL, extack); 184 184 } 185 185 186 186 /**
+197 -53
include/net/netlink.h
··· 369 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 402 int netlink_rcv_skb(struct sk_buff *skb, 373 403 int (*cb)(struct sk_buff *, struct nlmsghdr *, 374 404 struct netlink_ext_ack *)); 375 405 int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 portid, 376 406 unsigned int group, int report, gfp_t flags); 377 407 378 - int nla_validate(const struct nlattr *head, int len, int maxtype, 379 - const struct nla_policy *policy, 380 - struct netlink_ext_ack *extack); 381 - int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head, 382 - int len, const struct nla_policy *policy, 383 - 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); 408 + int __nla_validate(const struct nlattr *head, int len, int maxtype, 409 + const struct nla_policy *policy, unsigned int validate, 410 + struct netlink_ext_ack *extack); 411 + int __nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head, 412 + int len, const struct nla_policy *policy, unsigned int validate, 413 + struct netlink_ext_ack *extack); 387 414 int nla_policy_len(const struct nla_policy *, int); 388 415 struct nlattr *nla_find(const struct nlattr *head, int len, int attrtype); 389 416 size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize); ··· 539 512 } 540 513 541 514 /** 542 - * nlmsg_parse - parse attributes of a netlink message 515 + * nla_parse_deprecated - Parse a stream of attributes into a tb buffer 516 + * @tb: destination array with maxtype+1 elements 517 + * @maxtype: maximum attribute type to be expected 518 + * @head: head of attribute stream 519 + * @len: length of attribute stream 520 + * @policy: validation policy 521 + * @extack: extended ACK pointer 522 + * 523 + * Parses a stream of attributes and stores a pointer to each attribute in 524 + * the tb array accessible via the attribute type. Attributes with a type 525 + * exceeding maxtype will be ignored and attributes from the policy are not 526 + * always strictly validated (only for new attributes). 527 + * 528 + * Returns 0 on success or a negative error code. 529 + */ 530 + static inline int nla_parse_deprecated(struct nlattr **tb, int maxtype, 531 + const struct nlattr *head, int len, 532 + const struct nla_policy *policy, 533 + struct netlink_ext_ack *extack) 534 + { 535 + return __nla_parse(tb, maxtype, head, len, policy, 536 + NL_VALIDATE_LIBERAL, extack); 537 + } 538 + 539 + /** 540 + * nla_parse_deprecated_strict - Parse a stream of attributes into a tb buffer 541 + * @tb: destination array with maxtype+1 elements 542 + * @maxtype: maximum attribute type to be expected 543 + * @head: head of attribute stream 544 + * @len: length of attribute stream 545 + * @policy: validation policy 546 + * @extack: extended ACK pointer 547 + * 548 + * Parses a stream of attributes and stores a pointer to each attribute in 549 + * the tb array accessible via the attribute type. Attributes with a type 550 + * exceeding maxtype will be rejected as well as trailing data, but the 551 + * policy is not completely strictly validated (only for new attributes). 552 + * 553 + * Returns 0 on success or a negative error code. 554 + */ 555 + static inline int nla_parse_deprecated_strict(struct nlattr **tb, int maxtype, 556 + const struct nlattr *head, 557 + int len, 558 + const struct nla_policy *policy, 559 + struct netlink_ext_ack *extack) 560 + { 561 + return __nla_parse(tb, maxtype, head, len, policy, 562 + NL_VALIDATE_DEPRECATED_STRICT, extack); 563 + } 564 + 565 + /** 566 + * __nlmsg_parse - parse attributes of a netlink message 543 567 * @nlh: netlink message header 544 568 * @hdrlen: length of family specific header 545 569 * @tb: destination array with maxtype+1 elements 546 570 * @maxtype: maximum attribute type to be expected 547 571 * @policy: validation policy 572 + * @validate: validation strictness 548 573 * @extack: extended ACK report struct 549 574 * 550 575 * See nla_parse() 551 576 */ 552 - static inline int nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen, 577 + static inline int __nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen, 578 + struct nlattr *tb[], int maxtype, 579 + const struct nla_policy *policy, 580 + unsigned int validate, 581 + struct netlink_ext_ack *extack) 582 + { 583 + if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) { 584 + NL_SET_ERR_MSG(extack, "Invalid header length"); 585 + return -EINVAL; 586 + } 587 + 588 + return __nla_parse(tb, maxtype, nlmsg_attrdata(nlh, hdrlen), 589 + nlmsg_attrlen(nlh, hdrlen), policy, validate, 590 + extack); 591 + } 592 + 593 + /** 594 + * nlmsg_parse_deprecated - parse attributes of a netlink message 595 + * @nlh: netlink message header 596 + * @hdrlen: length of family specific header 597 + * @tb: destination array with maxtype+1 elements 598 + * @maxtype: maximum attribute type to be expected 599 + * @extack: extended ACK report struct 600 + * 601 + * See nla_parse_deprecated() 602 + */ 603 + static inline int nlmsg_parse_deprecated(const struct nlmsghdr *nlh, int hdrlen, 604 + struct nlattr *tb[], int maxtype, 605 + const struct nla_policy *policy, 606 + struct netlink_ext_ack *extack) 607 + { 608 + return __nlmsg_parse(nlh, hdrlen, tb, maxtype, policy, 609 + NL_VALIDATE_LIBERAL, extack); 610 + } 611 + 612 + /** 613 + * nlmsg_parse_deprecated_strict - parse attributes of a netlink message 614 + * @nlh: netlink message header 615 + * @hdrlen: length of family specific header 616 + * @tb: destination array with maxtype+1 elements 617 + * @maxtype: maximum attribute type to be expected 618 + * @extack: extended ACK report struct 619 + * 620 + * See nla_parse_deprecated_strict() 621 + */ 622 + static inline int 623 + nlmsg_parse_deprecated_strict(const struct nlmsghdr *nlh, int hdrlen, 553 624 struct nlattr *tb[], int maxtype, 554 625 const struct nla_policy *policy, 555 626 struct netlink_ext_ack *extack) 556 627 { 557 - if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) { 558 - NL_SET_ERR_MSG(extack, "Invalid header length"); 559 - return -EINVAL; 560 - } 561 - 562 - return nla_parse(tb, maxtype, nlmsg_attrdata(nlh, hdrlen), 563 - nlmsg_attrlen(nlh, hdrlen), policy, extack); 564 - } 565 - 566 - static inline int nlmsg_parse_strict(const struct nlmsghdr *nlh, int hdrlen, 567 - struct nlattr *tb[], int maxtype, 568 - const struct nla_policy *policy, 569 - struct netlink_ext_ack *extack) 570 - { 571 - if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) { 572 - NL_SET_ERR_MSG(extack, "Invalid header length"); 573 - return -EINVAL; 574 - } 575 - 576 - return nla_parse_strict(tb, maxtype, nlmsg_attrdata(nlh, hdrlen), 577 - nlmsg_attrlen(nlh, hdrlen), policy, extack); 628 + return __nlmsg_parse(nlh, hdrlen, tb, maxtype, policy, 629 + NL_VALIDATE_DEPRECATED_STRICT, extack); 578 630 } 579 631 580 632 /** ··· 672 566 } 673 567 674 568 /** 675 - * nlmsg_validate - validate a netlink message including attributes 569 + * nla_validate_deprecated - Validate a stream of attributes 570 + * @head: head of attribute stream 571 + * @len: length of attribute stream 572 + * @maxtype: maximum attribute type to be expected 573 + * @policy: validation policy 574 + * @validate: validation strictness 575 + * @extack: extended ACK report struct 576 + * 577 + * Validates all attributes in the specified attribute stream against the 578 + * specified policy. Validation is done in liberal mode. 579 + * See documenation of struct nla_policy for more details. 580 + * 581 + * Returns 0 on success or a negative error code. 582 + */ 583 + static inline int nla_validate_deprecated(const struct nlattr *head, int len, 584 + int maxtype, 585 + const struct nla_policy *policy, 586 + struct netlink_ext_ack *extack) 587 + { 588 + return __nla_validate(head, len, maxtype, policy, NL_VALIDATE_LIBERAL, 589 + extack); 590 + } 591 + 592 + 593 + /** 594 + * nlmsg_validate_deprecated - validate a netlink message including attributes 676 595 * @nlh: netlinket message header 677 596 * @hdrlen: length of familiy specific header 678 597 * @maxtype: maximum attribute type to be expected 679 598 * @policy: validation policy 680 599 * @extack: extended ACK report struct 681 600 */ 682 - static inline int nlmsg_validate(const struct nlmsghdr *nlh, 683 - int hdrlen, int maxtype, 684 - const struct nla_policy *policy, 685 - struct netlink_ext_ack *extack) 601 + static inline int nlmsg_validate_deprecated(const struct nlmsghdr *nlh, 602 + int hdrlen, int maxtype, 603 + const struct nla_policy *policy, 604 + struct netlink_ext_ack *extack) 686 605 { 687 606 if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) 688 607 return -EINVAL; 689 608 690 - return nla_validate(nlmsg_attrdata(nlh, hdrlen), 691 - nlmsg_attrlen(nlh, hdrlen), maxtype, policy, 692 - extack); 609 + return __nla_validate(nlmsg_attrdata(nlh, hdrlen), 610 + nlmsg_attrlen(nlh, hdrlen), maxtype, 611 + policy, NL_VALIDATE_LIBERAL, extack); 693 612 } 613 + 614 + 694 615 695 616 /** 696 617 * nlmsg_report - need to report back to application? ··· 1032 899 } 1033 900 1034 901 /** 1035 - * nla_parse_nested - parse nested attributes 902 + * nla_parse_nested_deprecated - parse nested attributes 1036 903 * @tb: destination array with maxtype+1 elements 1037 904 * @maxtype: maximum attribute type to be expected 1038 905 * @nla: attribute containing the nested attributes 1039 906 * @policy: validation policy 1040 907 * @extack: extended ACK report struct 1041 908 * 1042 - * See nla_parse() 909 + * See nla_parse_deprecated() 1043 910 */ 1044 - static inline int nla_parse_nested(struct nlattr *tb[], int maxtype, 1045 - const struct nlattr *nla, 1046 - const struct nla_policy *policy, 1047 - struct netlink_ext_ack *extack) 911 + static inline int nla_parse_nested_deprecated(struct nlattr *tb[], int maxtype, 912 + const struct nlattr *nla, 913 + const struct nla_policy *policy, 914 + struct netlink_ext_ack *extack) 1048 915 { 1049 - return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy, 1050 - extack); 916 + return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy, 917 + NL_VALIDATE_LIBERAL, extack); 1051 918 } 1052 919 1053 920 /** ··· 1622 1489 * @start: container attribute 1623 1490 * @maxtype: maximum attribute type to be expected 1624 1491 * @policy: validation policy 1492 + * @validate: validation strictness 1625 1493 * @extack: extended ACK report struct 1626 1494 * 1627 1495 * Validates all attributes in the nested attribute stream against the ··· 1631 1497 * 1632 1498 * Returns 0 on success or a negative error code. 1633 1499 */ 1634 - static inline int nla_validate_nested(const struct nlattr *start, int maxtype, 1635 - const struct nla_policy *policy, 1636 - struct netlink_ext_ack *extack) 1500 + static inline int __nla_validate_nested(const struct nlattr *start, int maxtype, 1501 + const struct nla_policy *policy, 1502 + unsigned int validate, 1503 + struct netlink_ext_ack *extack) 1637 1504 { 1638 - return nla_validate(nla_data(start), nla_len(start), maxtype, policy, 1639 - extack); 1505 + return __nla_validate(nla_data(start), nla_len(start), maxtype, policy, 1506 + validate, extack); 1507 + } 1508 + 1509 + static inline int 1510 + nla_validate_nested_deprecated(const struct nlattr *start, int maxtype, 1511 + const struct nla_policy *policy, 1512 + struct netlink_ext_ack *extack) 1513 + { 1514 + return __nla_validate_nested(start, maxtype, policy, 1515 + NL_VALIDATE_LIBERAL, extack); 1640 1516 } 1641 1517 1642 1518 /**
+3 -2
kernel/taskstats.c
··· 677 677 return -EINVAL; 678 678 } 679 679 680 - return nlmsg_validate(info->nlhdr, GENL_HDRLEN, TASKSTATS_CMD_ATTR_MAX, 681 - policy, info->extack); 680 + return nlmsg_validate_deprecated(info->nlhdr, GENL_HDRLEN, 681 + TASKSTATS_CMD_ATTR_MAX, policy, 682 + info->extack); 682 683 } 683 684 684 685 static struct genl_family family __ro_after_init = {
+92 -87
lib/nlattr.c
··· 69 69 70 70 static int nla_validate_array(const struct nlattr *head, int len, int maxtype, 71 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 75 const struct nlattr *entry; 75 76 int rem; ··· 87 86 return -ERANGE; 88 87 } 89 88 90 - ret = nla_validate(nla_data(entry), nla_len(entry), 91 - maxtype, policy, extack); 89 + ret = __nla_validate(nla_data(entry), nla_len(entry), 90 + maxtype, policy, validate, extack); 92 91 if (ret < 0) 93 92 return ret; 94 93 } ··· 155 154 } 156 155 157 156 static int validate_nla(const struct nlattr *nla, int maxtype, 158 - const struct nla_policy *policy, 157 + const struct nla_policy *policy, unsigned int validate, 159 158 struct netlink_ext_ack *extack) 160 159 { 161 160 const struct nla_policy *pt; ··· 173 172 (pt->type == NLA_EXACT_LEN_WARN && attrlen != pt->len)) { 174 173 pr_warn_ratelimited("netlink: '%s': attribute type %d has an invalid length.\n", 175 174 current->comm, type); 175 + if (validate & NL_VALIDATE_STRICT_ATTRS) { 176 + NL_SET_ERR_MSG_ATTR(extack, nla, 177 + "invalid attribute length"); 178 + return -EINVAL; 179 + } 176 180 } 177 181 178 182 switch (pt->type) { ··· 250 244 if (attrlen < NLA_HDRLEN) 251 245 goto out_err; 252 246 if (pt->validation_data) { 253 - err = nla_validate(nla_data(nla), nla_len(nla), pt->len, 254 - pt->validation_data, extack); 247 + err = __nla_validate(nla_data(nla), nla_len(nla), pt->len, 248 + pt->validation_data, validate, 249 + extack); 255 250 if (err < 0) { 256 251 /* 257 252 * return directly to preserve the inner ··· 275 268 276 269 err = nla_validate_array(nla_data(nla), nla_len(nla), 277 270 pt->len, pt->validation_data, 278 - extack); 271 + extack, validate); 279 272 if (err < 0) { 280 273 /* 281 274 * return directly to preserve the inner ··· 287 280 break; 288 281 289 282 case NLA_UNSPEC: 283 + if (validate & NL_VALIDATE_UNSPEC) { 284 + NL_SET_ERR_MSG_ATTR(extack, nla, 285 + "Unsupported attribute"); 286 + return -EINVAL; 287 + } 288 + /* fall through */ 290 289 case NLA_MIN_LEN: 291 290 if (attrlen < pt->len) 292 291 goto out_err; ··· 335 322 return err; 336 323 } 337 324 338 - /** 339 - * nla_validate - Validate a stream of attributes 340 - * @head: head of attribute stream 341 - * @len: length of attribute stream 342 - * @maxtype: maximum attribute type to be expected 343 - * @policy: validation policy 344 - * @extack: extended ACK report struct 345 - * 346 - * Validates all attributes in the specified attribute stream against the 347 - * specified policy. Attributes with a type exceeding maxtype will be 348 - * ignored. See documenation of struct nla_policy for more details. 349 - * 350 - * Returns 0 on success or a negative error code. 351 - */ 352 - int nla_validate(const struct nlattr *head, int len, int maxtype, 353 - const struct nla_policy *policy, 354 - struct netlink_ext_ack *extack) 325 + static int __nla_validate_parse(const struct nlattr *head, int len, int maxtype, 326 + const struct nla_policy *policy, 327 + unsigned int validate, 328 + struct netlink_ext_ack *extack, 329 + struct nlattr **tb) 355 330 { 356 331 const struct nlattr *nla; 357 332 int rem; 358 333 359 - nla_for_each_attr(nla, head, len, rem) { 360 - int err = validate_nla(nla, maxtype, policy, extack); 334 + if (tb) 335 + memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); 361 336 362 - if (err < 0) 363 - return err; 337 + nla_for_each_attr(nla, head, len, rem) { 338 + u16 type = nla_type(nla); 339 + 340 + if (type == 0 || type > maxtype) { 341 + if (validate & NL_VALIDATE_MAXTYPE) { 342 + NL_SET_ERR_MSG(extack, "Unknown attribute type"); 343 + return -EINVAL; 344 + } 345 + continue; 346 + } 347 + if (policy) { 348 + int err = validate_nla(nla, maxtype, policy, 349 + validate, extack); 350 + 351 + if (err < 0) 352 + return err; 353 + } 354 + 355 + if (tb) 356 + tb[type] = (struct nlattr *)nla; 357 + } 358 + 359 + if (unlikely(rem > 0)) { 360 + pr_warn_ratelimited("netlink: %d bytes leftover after parsing attributes in process `%s'.\n", 361 + rem, current->comm); 362 + NL_SET_ERR_MSG(extack, "bytes leftover after parsing attributes"); 363 + if (validate & NL_VALIDATE_TRAILING) 364 + return -EINVAL; 364 365 } 365 366 366 367 return 0; 367 368 } 368 - EXPORT_SYMBOL(nla_validate); 369 + 370 + /** 371 + * __nla_validate - Validate a stream of attributes 372 + * @head: head of attribute stream 373 + * @len: length of attribute stream 374 + * @maxtype: maximum attribute type to be expected 375 + * @policy: validation policy 376 + * @validate: validation strictness 377 + * @extack: extended ACK report struct 378 + * 379 + * Validates all attributes in the specified attribute stream against the 380 + * specified policy. Validation depends on the validate flags passed, see 381 + * &enum netlink_validation for more details on that. 382 + * See documenation of struct nla_policy for more details. 383 + * 384 + * Returns 0 on success or a negative error code. 385 + */ 386 + int __nla_validate(const struct nlattr *head, int len, int maxtype, 387 + const struct nla_policy *policy, unsigned int validate, 388 + struct netlink_ext_ack *extack) 389 + { 390 + return __nla_validate_parse(head, len, maxtype, policy, validate, 391 + extack, NULL); 392 + } 393 + EXPORT_SYMBOL(__nla_validate); 369 394 370 395 /** 371 396 * nla_policy_len - Determin the max. length of a policy ··· 435 384 EXPORT_SYMBOL(nla_policy_len); 436 385 437 386 /** 438 - * nla_parse - Parse a stream of attributes into a tb buffer 387 + * __nla_parse - Parse a stream of attributes into a tb buffer 439 388 * @tb: destination array with maxtype+1 elements 440 389 * @maxtype: maximum attribute type to be expected 441 390 * @head: head of attribute stream 442 391 * @len: length of attribute stream 443 392 * @policy: validation policy 393 + * @validate: validation strictness 394 + * @extack: extended ACK pointer 444 395 * 445 396 * Parses a stream of attributes and stores a pointer to each attribute in 446 - * the tb array accessible via the attribute type. Attributes with a type 447 - * exceeding maxtype will be silently ignored for backwards compatibility 448 - * reasons. policy may be set to NULL if no validation is required. 397 + * the tb array accessible via the attribute type. 398 + * Validation is controlled by the @validate parameter. 449 399 * 450 400 * Returns 0 on success or a negative error code. 451 401 */ 452 - static int __nla_parse(struct nlattr **tb, int maxtype, 453 - const struct nlattr *head, int len, 454 - bool strict, const struct nla_policy *policy, 455 - struct netlink_ext_ack *extack) 402 + int __nla_parse(struct nlattr **tb, int maxtype, 403 + const struct nlattr *head, int len, 404 + const struct nla_policy *policy, unsigned int validate, 405 + struct netlink_ext_ack *extack) 456 406 { 457 - const struct nlattr *nla; 458 - int rem; 459 - 460 - memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); 461 - 462 - nla_for_each_attr(nla, head, len, rem) { 463 - u16 type = nla_type(nla); 464 - 465 - if (type == 0 || type > maxtype) { 466 - if (strict) { 467 - NL_SET_ERR_MSG(extack, "Unknown attribute type"); 468 - return -EINVAL; 469 - } 470 - continue; 471 - } 472 - if (policy) { 473 - int err = validate_nla(nla, maxtype, policy, extack); 474 - 475 - if (err < 0) 476 - return err; 477 - } 478 - 479 - tb[type] = (struct nlattr *)nla; 480 - } 481 - 482 - if (unlikely(rem > 0)) { 483 - pr_warn_ratelimited("netlink: %d bytes leftover after parsing attributes in process `%s'.\n", 484 - rem, current->comm); 485 - NL_SET_ERR_MSG(extack, "bytes leftover after parsing attributes"); 486 - if (strict) 487 - return -EINVAL; 488 - } 489 - 490 - return 0; 407 + return __nla_validate_parse(head, len, maxtype, policy, validate, 408 + extack, tb); 491 409 } 492 - 493 - int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head, 494 - int len, const struct nla_policy *policy, 495 - struct netlink_ext_ack *extack) 496 - { 497 - return __nla_parse(tb, maxtype, head, len, false, policy, extack); 498 - } 499 - EXPORT_SYMBOL(nla_parse); 500 - 501 - int nla_parse_strict(struct nlattr **tb, int maxtype, const struct nlattr *head, 502 - int len, const struct nla_policy *policy, 503 - struct netlink_ext_ack *extack) 504 - { 505 - return __nla_parse(tb, maxtype, head, len, true, policy, extack); 506 - } 507 - EXPORT_SYMBOL(nla_parse_strict); 410 + EXPORT_SYMBOL(__nla_parse); 508 411 509 412 /** 510 413 * nla_find - Find a specific attribute in a stream of attributes
+2 -2
net/8021q/vlan_netlink.c
··· 35 35 { 36 36 if (!attr) 37 37 return 0; 38 - return nla_validate_nested(attr, IFLA_VLAN_QOS_MAX, vlan_map_policy, 39 - NULL); 38 + return nla_validate_nested_deprecated(attr, IFLA_VLAN_QOS_MAX, 39 + vlan_map_policy, NULL); 40 40 } 41 41 42 42 static int vlan_validate(struct nlattr *tb[], struct nlattr *data[],
+2 -2
net/bridge/br_mdb.c
··· 530 530 struct net_device *dev; 531 531 int err; 532 532 533 - err = nlmsg_parse(nlh, sizeof(*bpm), tb, MDBA_SET_ENTRY_MAX, NULL, 534 - NULL); 533 + err = nlmsg_parse_deprecated(nlh, sizeof(*bpm), tb, 534 + MDBA_SET_ENTRY_MAX, NULL, NULL); 535 535 if (err < 0) 536 536 return err; 537 537
+4 -2
net/bridge/br_netlink.c
··· 880 880 881 881 if (p && protinfo) { 882 882 if (protinfo->nla_type & NLA_F_NESTED) { 883 - err = nla_parse_nested(tb, IFLA_BRPORT_MAX, protinfo, 884 - br_port_policy, NULL); 883 + err = nla_parse_nested_deprecated(tb, IFLA_BRPORT_MAX, 884 + protinfo, 885 + br_port_policy, 886 + NULL); 885 887 if (err) 886 888 return err; 887 889
+2 -2
net/can/gw.c
··· 662 662 /* initialize modification & checksum data space */ 663 663 memset(mod, 0, sizeof(*mod)); 664 664 665 - err = nlmsg_parse(nlh, sizeof(struct rtcanmsg), tb, CGW_MAX, 666 - cgw_policy, NULL); 665 + err = nlmsg_parse_deprecated(nlh, sizeof(struct rtcanmsg), tb, 666 + CGW_MAX, cgw_policy, NULL); 667 667 if (err < 0) 668 668 return err; 669 669
+4 -3
net/core/devlink.c
··· 3674 3674 if (!attrs) 3675 3675 return -ENOMEM; 3676 3676 3677 - err = nlmsg_parse(cb->nlh, GENL_HDRLEN + devlink_nl_family.hdrsize, 3678 - attrs, DEVLINK_ATTR_MAX, devlink_nl_family.policy, 3679 - cb->extack); 3677 + err = nlmsg_parse_deprecated(cb->nlh, 3678 + GENL_HDRLEN + devlink_nl_family.hdrsize, 3679 + attrs, DEVLINK_ATTR_MAX, 3680 + devlink_nl_family.policy, cb->extack); 3680 3681 if (err) 3681 3682 goto out_free; 3682 3683
+4 -2
net/core/fib_rules.c
··· 746 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 751 if (err < 0) { 751 752 NL_SET_ERR_MSG(extack, "Error parsing msg"); 752 753 goto errout; ··· 854 853 goto errout; 855 854 } 856 855 857 - err = nlmsg_parse(nlh, sizeof(*frh), tb, FRA_MAX, ops->policy, extack); 856 + err = nlmsg_parse_deprecated(nlh, sizeof(*frh), tb, FRA_MAX, 857 + ops->policy, extack); 858 858 if (err < 0) { 859 859 NL_SET_ERR_MSG(extack, "Error parsing msg"); 860 860 goto errout;
+4 -3
net/core/lwt_bpf.c
··· 343 343 int ret; 344 344 u32 fd; 345 345 346 - ret = nla_parse_nested(tb, LWT_BPF_PROG_MAX, attr, bpf_prog_policy, 347 - NULL); 346 + ret = nla_parse_nested_deprecated(tb, LWT_BPF_PROG_MAX, attr, 347 + bpf_prog_policy, NULL); 348 348 if (ret < 0) 349 349 return ret; 350 350 ··· 385 385 if (family != AF_INET && family != AF_INET6) 386 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 390 if (ret < 0) 390 391 return ret; 391 392
+14 -11
net/core/neighbour.c
··· 1862 1862 int err; 1863 1863 1864 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 1867 if (err < 0) 1867 1868 goto out; 1868 1869 ··· 2182 2181 bool found = false; 2183 2182 int err, tidx; 2184 2183 2185 - err = nlmsg_parse(nlh, sizeof(*ndtmsg), tb, NDTA_MAX, 2186 - nl_neightbl_policy, extack); 2184 + err = nlmsg_parse_deprecated(nlh, sizeof(*ndtmsg), tb, NDTA_MAX, 2185 + nl_neightbl_policy, extack); 2187 2186 if (err < 0) 2188 2187 goto errout; 2189 2188 ··· 2220 2219 struct neigh_parms *p; 2221 2220 int i, ifindex = 0; 2222 2221 2223 - err = nla_parse_nested(tbp, NDTPA_MAX, tb[NDTA_PARMS], 2224 - nl_ntbl_parm_policy, extack); 2222 + err = nla_parse_nested_deprecated(tbp, NDTPA_MAX, 2223 + tb[NDTA_PARMS], 2224 + nl_ntbl_parm_policy, extack); 2225 2225 if (err < 0) 2226 2226 goto errout_tbl_lock; 2227 2227 ··· 2662 2660 return -EINVAL; 2663 2661 } 2664 2662 2665 - err = nlmsg_parse_strict(nlh, sizeof(struct ndmsg), tb, NDA_MAX, 2666 - nda_policy, extack); 2663 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct ndmsg), 2664 + tb, NDA_MAX, nda_policy, 2665 + extack); 2667 2666 } else { 2668 - err = nlmsg_parse(nlh, sizeof(struct ndmsg), tb, NDA_MAX, 2669 - nda_policy, extack); 2667 + err = nlmsg_parse_deprecated(nlh, sizeof(struct ndmsg), tb, 2668 + NDA_MAX, nda_policy, extack); 2670 2669 } 2671 2670 if (err < 0) 2672 2671 return err; ··· 2767 2764 return -EINVAL; 2768 2765 } 2769 2766 2770 - err = nlmsg_parse_strict(nlh, sizeof(struct ndmsg), tb, NDA_MAX, 2771 - nda_policy, extack); 2767 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct ndmsg), tb, 2768 + NDA_MAX, nda_policy, extack); 2772 2769 if (err < 0) 2773 2770 return err; 2774 2771
+11 -8
net/core/net_namespace.c
··· 682 682 struct net *peer; 683 683 int nsid, err; 684 684 685 - err = nlmsg_parse(nlh, sizeof(struct rtgenmsg), tb, NETNSA_MAX, 686 - rtnl_net_policy, extack); 685 + err = nlmsg_parse_deprecated(nlh, sizeof(struct rtgenmsg), tb, 686 + NETNSA_MAX, rtnl_net_policy, extack); 687 687 if (err < 0) 688 688 return err; 689 689 if (!tb[NETNSA_NSID]) { ··· 787 787 int i, err; 788 788 789 789 if (!netlink_strict_get_check(skb)) 790 - return nlmsg_parse(nlh, sizeof(struct rtgenmsg), tb, NETNSA_MAX, 791 - rtnl_net_policy, extack); 790 + return nlmsg_parse_deprecated(nlh, sizeof(struct rtgenmsg), 791 + tb, NETNSA_MAX, rtnl_net_policy, 792 + extack); 792 793 793 - err = nlmsg_parse_strict(nlh, sizeof(struct rtgenmsg), tb, NETNSA_MAX, 794 - rtnl_net_policy, extack); 794 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct rtgenmsg), tb, 795 + NETNSA_MAX, rtnl_net_policy, 796 + extack); 795 797 if (err) 796 798 return err; 797 799 ··· 931 929 struct nlattr *tb[NETNSA_MAX + 1]; 932 930 int err, i; 933 931 934 - err = nlmsg_parse_strict(nlh, sizeof(struct rtgenmsg), tb, NETNSA_MAX, 935 - rtnl_net_policy, extack); 932 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct rtgenmsg), tb, 933 + NETNSA_MAX, rtnl_net_policy, 934 + extack); 936 935 if (err < 0) 937 936 return err; 938 937
+62 -45
net/core/rtnetlink.c
··· 1797 1797 const struct rtnl_link_ops *ops = NULL; 1798 1798 struct nlattr *linfo[IFLA_INFO_MAX + 1]; 1799 1799 1800 - if (nla_parse_nested(linfo, IFLA_INFO_MAX, nla, 1801 - ifla_info_policy, NULL) < 0) 1800 + if (nla_parse_nested_deprecated(linfo, IFLA_INFO_MAX, nla, ifla_info_policy, NULL) < 0) 1802 1801 return NULL; 1803 1802 1804 1803 if (linfo[IFLA_INFO_KIND]) { ··· 1896 1897 return -EINVAL; 1897 1898 } 1898 1899 1899 - return nlmsg_parse_strict(nlh, sizeof(*ifm), tb, IFLA_MAX, 1900 - ifla_policy, extack); 1900 + return nlmsg_parse_deprecated_strict(nlh, sizeof(*ifm), tb, 1901 + IFLA_MAX, ifla_policy, 1902 + extack); 1901 1903 } 1902 1904 1903 1905 /* A hack to preserve kernel<->userspace interface. ··· 1911 1911 hdrlen = nlmsg_len(nlh) < sizeof(struct ifinfomsg) ? 1912 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 1918 static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) ··· 2020 2019 int rtnl_nla_parse_ifla(struct nlattr **tb, const struct nlattr *head, int len, 2021 2020 struct netlink_ext_ack *exterr) 2022 2021 { 2023 - return nla_parse(tb, IFLA_MAX, head, len, ifla_policy, exterr); 2022 + return nla_parse_deprecated(tb, IFLA_MAX, head, len, ifla_policy, 2023 + exterr); 2024 2024 } 2025 2025 EXPORT_SYMBOL(rtnl_nla_parse_ifla); 2026 2026 ··· 2566 2564 err = -EINVAL; 2567 2565 goto errout; 2568 2566 } 2569 - err = nla_parse_nested(vfinfo, IFLA_VF_MAX, attr, 2570 - ifla_vf_policy, NULL); 2567 + err = nla_parse_nested_deprecated(vfinfo, IFLA_VF_MAX, 2568 + attr, 2569 + ifla_vf_policy, 2570 + NULL); 2571 2571 if (err < 0) 2572 2572 goto errout; 2573 2573 err = do_setvfinfo(dev, vfinfo); ··· 2596 2592 err = -EINVAL; 2597 2593 goto errout; 2598 2594 } 2599 - err = nla_parse_nested(port, IFLA_PORT_MAX, attr, 2600 - ifla_port_policy, NULL); 2595 + err = nla_parse_nested_deprecated(port, IFLA_PORT_MAX, 2596 + attr, 2597 + ifla_port_policy, 2598 + NULL); 2601 2599 if (err < 0) 2602 2600 goto errout; 2603 2601 if (!port[IFLA_PORT_VF]) { ··· 2618 2612 if (tb[IFLA_PORT_SELF]) { 2619 2613 struct nlattr *port[IFLA_PORT_MAX+1]; 2620 2614 2621 - err = nla_parse_nested(port, IFLA_PORT_MAX, 2622 - tb[IFLA_PORT_SELF], ifla_port_policy, 2623 - NULL); 2615 + err = nla_parse_nested_deprecated(port, IFLA_PORT_MAX, 2616 + tb[IFLA_PORT_SELF], 2617 + ifla_port_policy, NULL); 2624 2618 if (err < 0) 2625 2619 goto errout; 2626 2620 ··· 2667 2661 struct nlattr *xdp[IFLA_XDP_MAX + 1]; 2668 2662 u32 xdp_flags = 0; 2669 2663 2670 - err = nla_parse_nested(xdp, IFLA_XDP_MAX, tb[IFLA_XDP], 2671 - ifla_xdp_policy, NULL); 2664 + err = nla_parse_nested_deprecated(xdp, IFLA_XDP_MAX, 2665 + tb[IFLA_XDP], 2666 + ifla_xdp_policy, NULL); 2672 2667 if (err < 0) 2673 2668 goto errout; 2674 2669 ··· 2723 2716 struct nlattr *tb[IFLA_MAX+1]; 2724 2717 char ifname[IFNAMSIZ]; 2725 2718 2726 - err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, 2727 - extack); 2719 + err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFLA_MAX, 2720 + ifla_policy, extack); 2728 2721 if (err < 0) 2729 2722 goto errout; 2730 2723 ··· 2820 2813 int err; 2821 2814 int netnsid = -1; 2822 2815 2823 - err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, extack); 2816 + err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFLA_MAX, 2817 + ifla_policy, extack); 2824 2818 if (err < 0) 2825 2819 return err; 2826 2820 ··· 2998 2990 #ifdef CONFIG_MODULES 2999 2991 replay: 3000 2992 #endif 3001 - err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, extack); 2993 + err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFLA_MAX, 2994 + ifla_policy, extack); 3002 2995 if (err < 0) 3003 2996 return err; 3004 2997 ··· 3033 3024 return err; 3034 3025 3035 3026 if (tb[IFLA_LINKINFO]) { 3036 - err = nla_parse_nested(linkinfo, IFLA_INFO_MAX, 3037 - tb[IFLA_LINKINFO], ifla_info_policy, 3038 - NULL); 3027 + err = nla_parse_nested_deprecated(linkinfo, IFLA_INFO_MAX, 3028 + tb[IFLA_LINKINFO], 3029 + ifla_info_policy, NULL); 3039 3030 if (err < 0) 3040 3031 return err; 3041 3032 } else ··· 3055 3046 return -EINVAL; 3056 3047 3057 3048 if (ops->maxtype && linkinfo[IFLA_INFO_DATA]) { 3058 - err = nla_parse_nested(attr, ops->maxtype, 3059 - linkinfo[IFLA_INFO_DATA], 3060 - ops->policy, extack); 3049 + err = nla_parse_nested_deprecated(attr, ops->maxtype, 3050 + linkinfo[IFLA_INFO_DATA], 3051 + ops->policy, extack); 3061 3052 if (err < 0) 3062 3053 return err; 3063 3054 data = attr; ··· 3076 3067 3077 3068 if (m_ops->slave_maxtype && 3078 3069 linkinfo[IFLA_INFO_SLAVE_DATA]) { 3079 - err = nla_parse_nested(slave_attr, m_ops->slave_maxtype, 3080 - linkinfo[IFLA_INFO_SLAVE_DATA], 3081 - m_ops->slave_policy, extack); 3070 + err = nla_parse_nested_deprecated(slave_attr, 3071 + m_ops->slave_maxtype, 3072 + linkinfo[IFLA_INFO_SLAVE_DATA], 3073 + m_ops->slave_policy, 3074 + extack); 3082 3075 if (err < 0) 3083 3076 return err; 3084 3077 slave_data = slave_attr; ··· 3261 3250 } 3262 3251 3263 3252 if (!netlink_strict_get_check(skb)) 3264 - return nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, 3265 - extack); 3253 + return nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFLA_MAX, 3254 + ifla_policy, extack); 3266 3255 3267 3256 ifm = nlmsg_data(nlh); 3268 3257 if (ifm->__ifi_pad || ifm->ifi_type || ifm->ifi_flags || ··· 3271 3260 return -EINVAL; 3272 3261 } 3273 3262 3274 - err = nlmsg_parse_strict(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy, 3275 - extack); 3263 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(*ifm), tb, IFLA_MAX, 3264 + ifla_policy, extack); 3276 3265 if (err) 3277 3266 return err; 3278 3267 ··· 3377 3366 hdrlen = nlmsg_len(nlh) < sizeof(struct ifinfomsg) ? 3378 3367 sizeof(struct rtgenmsg) : sizeof(struct ifinfomsg); 3379 3368 3380 - if (nlmsg_parse(nlh, hdrlen, tb, IFLA_MAX, ifla_policy, NULL) >= 0) { 3369 + if (nlmsg_parse_deprecated(nlh, hdrlen, tb, IFLA_MAX, ifla_policy, NULL) >= 0) { 3381 3370 if (tb[IFLA_EXT_MASK]) 3382 3371 ext_filter_mask = nla_get_u32(tb[IFLA_EXT_MASK]); 3383 3372 } ··· 3650 3639 u16 vid; 3651 3640 int err; 3652 3641 3653 - err = nlmsg_parse(nlh, sizeof(*ndm), tb, NDA_MAX, NULL, extack); 3642 + err = nlmsg_parse_deprecated(nlh, sizeof(*ndm), tb, NDA_MAX, NULL, 3643 + extack); 3654 3644 if (err < 0) 3655 3645 return err; 3656 3646 ··· 3761 3749 if (!netlink_capable(skb, CAP_NET_ADMIN)) 3762 3750 return -EPERM; 3763 3751 3764 - err = nlmsg_parse(nlh, sizeof(*ndm), tb, NDA_MAX, NULL, extack); 3752 + err = nlmsg_parse_deprecated(nlh, sizeof(*ndm), tb, NDA_MAX, NULL, 3753 + extack); 3765 3754 if (err < 0) 3766 3755 return err; 3767 3756 ··· 3911 3898 return -EINVAL; 3912 3899 } 3913 3900 3914 - err = nlmsg_parse_strict(nlh, sizeof(struct ndmsg), tb, NDA_MAX, 3915 - NULL, extack); 3901 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct ndmsg), tb, 3902 + NDA_MAX, NULL, extack); 3916 3903 if (err < 0) 3917 3904 return err; 3918 3905 ··· 3964 3951 nla_attr_size(sizeof(u32)))) { 3965 3952 struct ifinfomsg *ifm; 3966 3953 3967 - err = nlmsg_parse(nlh, sizeof(struct ifinfomsg), tb, IFLA_MAX, 3968 - ifla_policy, extack); 3954 + err = nlmsg_parse_deprecated(nlh, sizeof(struct ifinfomsg), 3955 + tb, IFLA_MAX, ifla_policy, 3956 + extack); 3969 3957 if (err < 0) { 3970 3958 return -EINVAL; 3971 3959 } else if (err == 0) { ··· 4105 4091 return -EINVAL; 4106 4092 } 4107 4093 4108 - err = nlmsg_parse_strict(nlh, sizeof(struct ndmsg), tb, NDA_MAX, 4109 - nda_policy, extack); 4094 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct ndmsg), tb, 4095 + NDA_MAX, nda_policy, extack); 4110 4096 if (err < 0) 4111 4097 return err; 4112 4098 ··· 4368 4354 return -EINVAL; 4369 4355 } 4370 4356 4371 - err = nlmsg_parse_strict(nlh, sizeof(struct ifinfomsg), tb, 4372 - IFLA_MAX, ifla_policy, extack); 4357 + err = nlmsg_parse_deprecated_strict(nlh, 4358 + sizeof(struct ifinfomsg), 4359 + tb, IFLA_MAX, ifla_policy, 4360 + extack); 4373 4361 } else { 4374 - err = nlmsg_parse(nlh, sizeof(struct ifinfomsg), tb, 4375 - IFLA_MAX, ifla_policy, extack); 4362 + err = nlmsg_parse_deprecated(nlh, sizeof(struct ifinfomsg), 4363 + tb, IFLA_MAX, ifla_policy, 4364 + extack); 4376 4365 } 4377 4366 if (err < 0) 4378 4367 return err;
+54 -36
net/dcb/dcbnl.c
··· 241 241 if (!netdev->dcbnl_ops->getpfccfg) 242 242 return -EOPNOTSUPP; 243 243 244 - ret = nla_parse_nested(data, DCB_PFC_UP_ATTR_MAX, 245 - tb[DCB_ATTR_PFC_CFG], dcbnl_pfc_up_nest, NULL); 244 + ret = nla_parse_nested_deprecated(data, DCB_PFC_UP_ATTR_MAX, 245 + tb[DCB_ATTR_PFC_CFG], 246 + dcbnl_pfc_up_nest, NULL); 246 247 if (ret) 247 248 return ret; 248 249 ··· 300 299 if (!netdev->dcbnl_ops->getcap) 301 300 return -EOPNOTSUPP; 302 301 303 - ret = nla_parse_nested(data, DCB_CAP_ATTR_MAX, tb[DCB_ATTR_CAP], 304 - dcbnl_cap_nest, NULL); 302 + ret = nla_parse_nested_deprecated(data, DCB_CAP_ATTR_MAX, 303 + tb[DCB_ATTR_CAP], dcbnl_cap_nest, 304 + NULL); 305 305 if (ret) 306 306 return ret; 307 307 ··· 345 343 if (!netdev->dcbnl_ops->getnumtcs) 346 344 return -EOPNOTSUPP; 347 345 348 - ret = nla_parse_nested(data, DCB_NUMTCS_ATTR_MAX, tb[DCB_ATTR_NUMTCS], 349 - dcbnl_numtcs_nest, NULL); 346 + ret = nla_parse_nested_deprecated(data, DCB_NUMTCS_ATTR_MAX, 347 + tb[DCB_ATTR_NUMTCS], 348 + dcbnl_numtcs_nest, NULL); 350 349 if (ret) 351 350 return ret; 352 351 ··· 391 388 if (!netdev->dcbnl_ops->setnumtcs) 392 389 return -EOPNOTSUPP; 393 390 394 - ret = nla_parse_nested(data, DCB_NUMTCS_ATTR_MAX, tb[DCB_ATTR_NUMTCS], 395 - dcbnl_numtcs_nest, NULL); 391 + ret = nla_parse_nested_deprecated(data, DCB_NUMTCS_ATTR_MAX, 392 + tb[DCB_ATTR_NUMTCS], 393 + dcbnl_numtcs_nest, NULL); 396 394 if (ret) 397 395 return ret; 398 396 ··· 451 447 if (!tb[DCB_ATTR_APP]) 452 448 return -EINVAL; 453 449 454 - ret = nla_parse_nested(app_tb, DCB_APP_ATTR_MAX, tb[DCB_ATTR_APP], 455 - dcbnl_app_nest, NULL); 450 + ret = nla_parse_nested_deprecated(app_tb, DCB_APP_ATTR_MAX, 451 + tb[DCB_ATTR_APP], dcbnl_app_nest, 452 + NULL); 456 453 if (ret) 457 454 return ret; 458 455 ··· 520 515 if (!tb[DCB_ATTR_APP]) 521 516 return -EINVAL; 522 517 523 - ret = nla_parse_nested(app_tb, DCB_APP_ATTR_MAX, tb[DCB_ATTR_APP], 524 - dcbnl_app_nest, NULL); 518 + ret = nla_parse_nested_deprecated(app_tb, DCB_APP_ATTR_MAX, 519 + tb[DCB_ATTR_APP], dcbnl_app_nest, 520 + NULL); 525 521 if (ret) 526 522 return ret; 527 523 ··· 579 573 !netdev->dcbnl_ops->getpgbwgcfgrx) 580 574 return -EOPNOTSUPP; 581 575 582 - ret = nla_parse_nested(pg_tb, DCB_PG_ATTR_MAX, tb[DCB_ATTR_PG_CFG], 583 - dcbnl_pg_nest, NULL); 576 + ret = nla_parse_nested_deprecated(pg_tb, DCB_PG_ATTR_MAX, 577 + tb[DCB_ATTR_PG_CFG], dcbnl_pg_nest, 578 + NULL); 584 579 if (ret) 585 580 return ret; 586 581 ··· 600 593 data = pg_tb[DCB_PG_ATTR_TC_ALL]; 601 594 else 602 595 data = pg_tb[i]; 603 - ret = nla_parse_nested(param_tb, DCB_TC_ATTR_PARAM_MAX, data, 604 - dcbnl_tc_param_nest, NULL); 596 + ret = nla_parse_nested_deprecated(param_tb, 597 + DCB_TC_ATTR_PARAM_MAX, data, 598 + dcbnl_tc_param_nest, NULL); 605 599 if (ret) 606 600 goto err_pg; 607 601 ··· 738 730 if (!netdev->dcbnl_ops->setpfccfg) 739 731 return -EOPNOTSUPP; 740 732 741 - ret = nla_parse_nested(data, DCB_PFC_UP_ATTR_MAX, 742 - tb[DCB_ATTR_PFC_CFG], dcbnl_pfc_up_nest, NULL); 733 + ret = nla_parse_nested_deprecated(data, DCB_PFC_UP_ATTR_MAX, 734 + tb[DCB_ATTR_PFC_CFG], 735 + dcbnl_pfc_up_nest, NULL); 743 736 if (ret) 744 737 return ret; 745 738 ··· 795 786 !netdev->dcbnl_ops->setpgbwgcfgrx) 796 787 return -EOPNOTSUPP; 797 788 798 - ret = nla_parse_nested(pg_tb, DCB_PG_ATTR_MAX, tb[DCB_ATTR_PG_CFG], 799 - dcbnl_pg_nest, NULL); 789 + ret = nla_parse_nested_deprecated(pg_tb, DCB_PG_ATTR_MAX, 790 + tb[DCB_ATTR_PG_CFG], dcbnl_pg_nest, 791 + NULL); 800 792 if (ret) 801 793 return ret; 802 794 ··· 805 795 if (!pg_tb[i]) 806 796 continue; 807 797 808 - ret = nla_parse_nested(param_tb, DCB_TC_ATTR_PARAM_MAX, 809 - pg_tb[i], dcbnl_tc_param_nest, NULL); 798 + ret = nla_parse_nested_deprecated(param_tb, 799 + DCB_TC_ATTR_PARAM_MAX, 800 + pg_tb[i], 801 + dcbnl_tc_param_nest, NULL); 810 802 if (ret) 811 803 return ret; 812 804 ··· 896 884 !netdev->dcbnl_ops->getbcncfg) 897 885 return -EOPNOTSUPP; 898 886 899 - ret = nla_parse_nested(bcn_tb, DCB_BCN_ATTR_MAX, tb[DCB_ATTR_BCN], 900 - dcbnl_bcn_nest, NULL); 887 + ret = nla_parse_nested_deprecated(bcn_tb, DCB_BCN_ATTR_MAX, 888 + tb[DCB_ATTR_BCN], dcbnl_bcn_nest, 889 + NULL); 901 890 if (ret) 902 891 return ret; 903 892 ··· 956 943 !netdev->dcbnl_ops->setbcnrp) 957 944 return -EOPNOTSUPP; 958 945 959 - ret = nla_parse_nested(data, DCB_BCN_ATTR_MAX, tb[DCB_ATTR_BCN], 960 - dcbnl_pfc_up_nest, NULL); 946 + ret = nla_parse_nested_deprecated(data, DCB_BCN_ATTR_MAX, 947 + tb[DCB_ATTR_BCN], dcbnl_pfc_up_nest, 948 + NULL); 961 949 if (ret) 962 950 return ret; 963 951 ··· 1445 1431 if (!tb[DCB_ATTR_IEEE]) 1446 1432 return -EINVAL; 1447 1433 1448 - err = nla_parse_nested(ieee, DCB_ATTR_IEEE_MAX, tb[DCB_ATTR_IEEE], 1449 - dcbnl_ieee_policy, NULL); 1434 + err = nla_parse_nested_deprecated(ieee, DCB_ATTR_IEEE_MAX, 1435 + tb[DCB_ATTR_IEEE], 1436 + dcbnl_ieee_policy, NULL); 1450 1437 if (err) 1451 1438 return err; 1452 1439 ··· 1546 1531 if (!tb[DCB_ATTR_IEEE]) 1547 1532 return -EINVAL; 1548 1533 1549 - err = nla_parse_nested(ieee, DCB_ATTR_IEEE_MAX, tb[DCB_ATTR_IEEE], 1550 - dcbnl_ieee_policy, NULL); 1534 + err = nla_parse_nested_deprecated(ieee, DCB_ATTR_IEEE_MAX, 1535 + tb[DCB_ATTR_IEEE], 1536 + dcbnl_ieee_policy, NULL); 1551 1537 if (err) 1552 1538 return err; 1553 1539 ··· 1620 1604 if (!tb[DCB_ATTR_FEATCFG]) 1621 1605 return -EINVAL; 1622 1606 1623 - ret = nla_parse_nested(data, DCB_FEATCFG_ATTR_MAX, 1624 - tb[DCB_ATTR_FEATCFG], dcbnl_featcfg_nest, NULL); 1607 + ret = nla_parse_nested_deprecated(data, DCB_FEATCFG_ATTR_MAX, 1608 + tb[DCB_ATTR_FEATCFG], 1609 + dcbnl_featcfg_nest, NULL); 1625 1610 if (ret) 1626 1611 return ret; 1627 1612 ··· 1665 1648 if (!tb[DCB_ATTR_FEATCFG]) 1666 1649 return -EINVAL; 1667 1650 1668 - ret = nla_parse_nested(data, DCB_FEATCFG_ATTR_MAX, 1669 - tb[DCB_ATTR_FEATCFG], dcbnl_featcfg_nest, NULL); 1651 + ret = nla_parse_nested_deprecated(data, DCB_FEATCFG_ATTR_MAX, 1652 + tb[DCB_ATTR_FEATCFG], 1653 + dcbnl_featcfg_nest, NULL); 1670 1654 1671 1655 if (ret) 1672 1656 goto err; ··· 1756 1738 if ((nlh->nlmsg_type == RTM_SETDCB) && !netlink_capable(skb, CAP_NET_ADMIN)) 1757 1739 return -EPERM; 1758 1740 1759 - ret = nlmsg_parse(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX, 1760 - dcbnl_rtnl_policy, extack); 1741 + ret = nlmsg_parse_deprecated(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX, 1742 + dcbnl_rtnl_policy, extack); 1761 1743 if (ret < 0) 1762 1744 return ret; 1763 1745
+4 -4
net/decnet/dn_dev.c
··· 583 583 if (!net_eq(net, &init_net)) 584 584 goto errout; 585 585 586 - err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy, 587 - extack); 586 + err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, 587 + dn_ifa_policy, extack); 588 588 if (err < 0) 589 589 goto errout; 590 590 ··· 629 629 if (!net_eq(net, &init_net)) 630 630 return -EINVAL; 631 631 632 - err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy, 633 - extack); 632 + err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, 633 + dn_ifa_policy, extack); 634 634 if (err < 0) 635 635 return err; 636 636
+4 -4
net/decnet/dn_fib.c
··· 517 517 if (!net_eq(net, &init_net)) 518 518 return -EINVAL; 519 519 520 - err = nlmsg_parse(nlh, sizeof(*r), attrs, RTA_MAX, rtm_dn_policy, 521 - extack); 520 + err = nlmsg_parse_deprecated(nlh, sizeof(*r), attrs, RTA_MAX, 521 + rtm_dn_policy, extack); 522 522 if (err < 0) 523 523 return err; 524 524 ··· 544 544 if (!net_eq(net, &init_net)) 545 545 return -EINVAL; 546 546 547 - err = nlmsg_parse(nlh, sizeof(*r), attrs, RTA_MAX, rtm_dn_policy, 548 - extack); 547 + err = nlmsg_parse_deprecated(nlh, sizeof(*r), attrs, RTA_MAX, 548 + rtm_dn_policy, extack); 549 549 if (err < 0) 550 550 return err; 551 551
+2 -2
net/decnet/dn_route.c
··· 1651 1651 if (!net_eq(net, &init_net)) 1652 1652 return -EINVAL; 1653 1653 1654 - err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_dn_policy, 1655 - extack); 1654 + err = nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, 1655 + rtm_dn_policy, extack); 1656 1656 if (err < 0) 1657 1657 return err; 1658 1658
+18 -28
net/ieee802154/nl802154.c
··· 247 247 rtnl_lock(); 248 248 249 249 if (!cb->args[0]) { 250 - err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl802154_fam.hdrsize, 251 - genl_family_attrbuf(&nl802154_fam), 252 - nl802154_fam.maxattr, nl802154_policy, NULL); 250 + err = nlmsg_parse_deprecated(cb->nlh, 251 + GENL_HDRLEN + nl802154_fam.hdrsize, 252 + genl_family_attrbuf(&nl802154_fam), 253 + nl802154_fam.maxattr, 254 + nl802154_policy, NULL); 253 255 if (err) 254 256 goto out_unlock; 255 257 ··· 564 562 struct nl802154_dump_wpan_phy_state *state) 565 563 { 566 564 struct nlattr **tb = genl_family_attrbuf(&nl802154_fam); 567 - int ret = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl802154_fam.hdrsize, tb, 568 - nl802154_fam.maxattr, nl802154_policy, NULL); 565 + int ret = nlmsg_parse_deprecated(cb->nlh, 566 + GENL_HDRLEN + nl802154_fam.hdrsize, 567 + tb, nl802154_fam.maxattr, 568 + nl802154_policy, NULL); 569 569 570 570 /* TODO check if we can handle error here, 571 571 * we have no backward compatibility ··· 1312 1308 { 1313 1309 struct nlattr *attrs[NL802154_DEV_ADDR_ATTR_MAX + 1]; 1314 1310 1315 - if (!nla || nla_parse_nested(attrs, NL802154_DEV_ADDR_ATTR_MAX, nla, 1316 - nl802154_dev_addr_policy, NULL)) 1311 + if (!nla || nla_parse_nested_deprecated(attrs, NL802154_DEV_ADDR_ATTR_MAX, nla, nl802154_dev_addr_policy, NULL)) 1317 1312 return -EINVAL; 1318 1313 1319 1314 if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID] || ··· 1351 1348 { 1352 1349 struct nlattr *attrs[NL802154_KEY_ID_ATTR_MAX + 1]; 1353 1350 1354 - if (!nla || nla_parse_nested(attrs, NL802154_KEY_ID_ATTR_MAX, nla, 1355 - nl802154_key_id_policy, NULL)) 1351 + if (!nla || nla_parse_nested_deprecated(attrs, NL802154_KEY_ID_ATTR_MAX, nla, nl802154_key_id_policy, NULL)) 1356 1352 return -EINVAL; 1357 1353 1358 1354 if (!attrs[NL802154_KEY_ID_ATTR_MODE]) ··· 1566 1564 struct ieee802154_llsec_key_id id = { }; 1567 1565 u32 commands[NL802154_CMD_FRAME_NR_IDS / 32] = { }; 1568 1566 1569 - if (nla_parse_nested(attrs, NL802154_KEY_ATTR_MAX, 1570 - info->attrs[NL802154_ATTR_SEC_KEY], 1571 - nl802154_key_policy, info->extack)) 1567 + if (nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) 1572 1568 return -EINVAL; 1573 1569 1574 1570 if (!attrs[NL802154_KEY_ATTR_USAGE_FRAMES] || ··· 1614 1614 struct nlattr *attrs[NL802154_KEY_ATTR_MAX + 1]; 1615 1615 struct ieee802154_llsec_key_id id; 1616 1616 1617 - if (nla_parse_nested(attrs, NL802154_KEY_ATTR_MAX, 1618 - info->attrs[NL802154_ATTR_SEC_KEY], 1619 - nl802154_key_policy, info->extack)) 1617 + if (nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) 1620 1618 return -EINVAL; 1621 1619 1622 1620 if (ieee802154_llsec_parse_key_id(attrs[NL802154_KEY_ATTR_ID], &id) < 0) ··· 1728 1730 { 1729 1731 struct nlattr *attrs[NL802154_DEV_ATTR_MAX + 1]; 1730 1732 1731 - if (!nla || nla_parse_nested(attrs, NL802154_DEV_ATTR_MAX, 1732 - nla, nl802154_dev_policy, NULL)) 1733 + if (!nla || nla_parse_nested_deprecated(attrs, NL802154_DEV_ATTR_MAX, nla, nl802154_dev_policy, NULL)) 1733 1734 return -EINVAL; 1734 1735 1735 1736 memset(dev, 0, sizeof(*dev)); ··· 1779 1782 struct nlattr *attrs[NL802154_DEV_ATTR_MAX + 1]; 1780 1783 __le64 extended_addr; 1781 1784 1782 - if (nla_parse_nested(attrs, NL802154_DEV_ATTR_MAX, 1783 - info->attrs[NL802154_ATTR_SEC_DEVICE], 1784 - nl802154_dev_policy, info->extack)) 1785 + if (nla_parse_nested_deprecated(attrs, NL802154_DEV_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVICE], nl802154_dev_policy, info->extack)) 1785 1786 return -EINVAL; 1786 1787 1787 1788 if (!attrs[NL802154_DEV_ATTR_EXTENDED_ADDR]) ··· 1905 1910 __le64 extended_addr; 1906 1911 1907 1912 if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] || 1908 - nla_parse_nested(attrs, NL802154_DEVKEY_ATTR_MAX, 1909 - info->attrs[NL802154_ATTR_SEC_DEVKEY], 1910 - nl802154_devkey_policy, info->extack) < 0) 1913 + nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack) < 0) 1911 1914 return -EINVAL; 1912 1915 1913 1916 if (!attrs[NL802154_DEVKEY_ATTR_FRAME_COUNTER] || ··· 1935 1942 struct ieee802154_llsec_device_key key; 1936 1943 __le64 extended_addr; 1937 1944 1938 - if (nla_parse_nested(attrs, NL802154_DEVKEY_ATTR_MAX, 1939 - info->attrs[NL802154_ATTR_SEC_DEVKEY], 1940 - nl802154_devkey_policy, info->extack)) 1945 + if (nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack)) 1941 1946 return -EINVAL; 1942 1947 1943 1948 if (!attrs[NL802154_DEVKEY_ATTR_EXTENDED_ADDR]) ··· 2055 2064 { 2056 2065 struct nlattr *attrs[NL802154_SECLEVEL_ATTR_MAX + 1]; 2057 2066 2058 - if (!nla || nla_parse_nested(attrs, NL802154_SECLEVEL_ATTR_MAX, 2059 - nla, nl802154_seclevel_policy, NULL)) 2067 + if (!nla || nla_parse_nested_deprecated(attrs, NL802154_SECLEVEL_ATTR_MAX, nla, nl802154_seclevel_policy, NULL)) 2060 2068 return -EINVAL; 2061 2069 2062 2070 memset(sl, 0, sizeof(*sl));
+15 -12
net/ipv4/devinet.c
··· 621 621 622 622 ASSERT_RTNL(); 623 623 624 - err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv4_policy, 625 - extack); 624 + err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, 625 + ifa_ipv4_policy, extack); 626 626 if (err < 0) 627 627 goto errout; 628 628 ··· 793 793 struct in_device *in_dev; 794 794 int err; 795 795 796 - err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv4_policy, 797 - extack); 796 + err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, 797 + ifa_ipv4_policy, extack); 798 798 if (err < 0) 799 799 goto errout; 800 800 ··· 1689 1689 fillargs->flags |= NLM_F_DUMP_FILTERED; 1690 1690 } 1691 1691 1692 - err = nlmsg_parse_strict(nlh, sizeof(*ifm), tb, IFA_MAX, 1693 - ifa_ipv4_policy, extack); 1692 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(*ifm), tb, IFA_MAX, 1693 + ifa_ipv4_policy, extack); 1694 1694 if (err < 0) 1695 1695 return err; 1696 1696 ··· 1906 1906 if (dev && !__in_dev_get_rcu(dev)) 1907 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 1911 if (err < 0) 1911 1912 return err; 1912 1913 ··· 1935 1934 if (!in_dev) 1936 1935 return -EAFNOSUPPORT; 1937 1936 1938 - if (nla_parse_nested(tb, IFLA_INET_MAX, nla, NULL, NULL) < 0) 1937 + if (nla_parse_nested_deprecated(tb, IFLA_INET_MAX, nla, NULL, NULL) < 0) 1939 1938 BUG(); 1940 1939 1941 1940 if (tb[IFLA_INET_CONF]) { ··· 2077 2076 } 2078 2077 2079 2078 if (!netlink_strict_get_check(skb)) 2080 - return nlmsg_parse(nlh, sizeof(struct netconfmsg), tb, 2081 - NETCONFA_MAX, devconf_ipv4_policy, extack); 2079 + return nlmsg_parse_deprecated(nlh, sizeof(struct netconfmsg), 2080 + tb, NETCONFA_MAX, 2081 + devconf_ipv4_policy, extack); 2082 2082 2083 - err = nlmsg_parse_strict(nlh, sizeof(struct netconfmsg), tb, 2084 - NETCONFA_MAX, devconf_ipv4_policy, extack); 2083 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct netconfmsg), 2084 + tb, NETCONFA_MAX, 2085 + devconf_ipv4_policy, extack); 2085 2086 if (err) 2086 2087 return err; 2087 2088
+4 -4
net/ipv4/fib_frontend.c
··· 718 718 int err, remaining; 719 719 struct rtmsg *rtm; 720 720 721 - err = nlmsg_validate(nlh, sizeof(*rtm), RTA_MAX, rtm_ipv4_policy, 722 - extack); 721 + err = nlmsg_validate_deprecated(nlh, sizeof(*rtm), RTA_MAX, 722 + rtm_ipv4_policy, extack); 723 723 if (err < 0) 724 724 goto errout; 725 725 ··· 896 896 filter->rt_type = rtm->rtm_type; 897 897 filter->table_id = rtm->rtm_table; 898 898 899 - err = nlmsg_parse_strict(nlh, sizeof(*rtm), tb, RTA_MAX, 900 - rtm_ipv4_policy, extack); 899 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(*rtm), tb, RTA_MAX, 900 + rtm_ipv4_policy, extack); 901 901 if (err < 0) 902 902 return err; 903 903
+4 -4
net/ipv4/ip_tunnel_core.c
··· 239 239 struct nlattr *tb[LWTUNNEL_IP_MAX + 1]; 240 240 int err; 241 241 242 - err = nla_parse_nested(tb, LWTUNNEL_IP_MAX, attr, ip_tun_policy, 243 - extack); 242 + err = nla_parse_nested_deprecated(tb, LWTUNNEL_IP_MAX, attr, 243 + ip_tun_policy, extack); 244 244 if (err < 0) 245 245 return err; 246 246 ··· 356 356 struct nlattr *tb[LWTUNNEL_IP6_MAX + 1]; 357 357 int err; 358 358 359 - err = nla_parse_nested(tb, LWTUNNEL_IP6_MAX, attr, ip6_tun_policy, 360 - extack); 359 + err = nla_parse_nested_deprecated(tb, LWTUNNEL_IP6_MAX, attr, 360 + ip6_tun_policy, extack); 361 361 if (err < 0) 362 362 return err; 363 363
+6 -6
net/ipv4/ipmr.c
··· 2498 2498 } 2499 2499 2500 2500 if (!netlink_strict_get_check(skb)) 2501 - return nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, 2502 - rtm_ipv4_policy, extack); 2501 + return nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, 2502 + rtm_ipv4_policy, extack); 2503 2503 2504 2504 rtm = nlmsg_data(nlh); 2505 2505 if ((rtm->rtm_src_len && rtm->rtm_src_len != 32) || ··· 2510 2510 return -EINVAL; 2511 2511 } 2512 2512 2513 - err = nlmsg_parse_strict(nlh, sizeof(*rtm), tb, RTA_MAX, 2514 - rtm_ipv4_policy, extack); 2513 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(*rtm), tb, RTA_MAX, 2514 + rtm_ipv4_policy, extack); 2515 2515 if (err) 2516 2516 return err; 2517 2517 ··· 2674 2674 struct rtmsg *rtm; 2675 2675 int ret, rem; 2676 2676 2677 - ret = nlmsg_validate(nlh, sizeof(*rtm), RTA_MAX, rtm_ipmr_policy, 2678 - extack); 2677 + ret = nlmsg_validate_deprecated(nlh, sizeof(*rtm), RTA_MAX, 2678 + rtm_ipmr_policy, extack); 2679 2679 if (ret < 0) 2680 2680 goto out; 2681 2681 rtm = nlmsg_data(nlh);
+4 -4
net/ipv4/route.c
··· 2877 2877 } 2878 2878 2879 2879 if (!netlink_strict_get_check(skb)) 2880 - return nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, 2881 - rtm_ipv4_policy, extack); 2880 + return nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, 2881 + rtm_ipv4_policy, extack); 2882 2882 2883 2883 rtm = nlmsg_data(nlh); 2884 2884 if ((rtm->rtm_src_len && rtm->rtm_src_len != 32) || ··· 2896 2896 return -EINVAL; 2897 2897 } 2898 2898 2899 - err = nlmsg_parse_strict(nlh, sizeof(*rtm), tb, RTA_MAX, 2900 - rtm_ipv4_policy, extack); 2899 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(*rtm), tb, RTA_MAX, 2900 + rtm_ipv4_policy, extack); 2901 2901 if (err) 2902 2902 return err; 2903 2903
+19 -17
net/ipv6/addrconf.c
··· 611 611 } 612 612 613 613 if (!netlink_strict_get_check(skb)) 614 - return nlmsg_parse(nlh, sizeof(struct netconfmsg), tb, 615 - NETCONFA_MAX, devconf_ipv6_policy, extack); 614 + return nlmsg_parse_deprecated(nlh, sizeof(struct netconfmsg), 615 + tb, NETCONFA_MAX, 616 + devconf_ipv6_policy, extack); 616 617 617 - err = nlmsg_parse_strict(nlh, sizeof(struct netconfmsg), tb, 618 - NETCONFA_MAX, devconf_ipv6_policy, extack); 618 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct netconfmsg), 619 + tb, NETCONFA_MAX, 620 + devconf_ipv6_policy, extack); 619 621 if (err) 620 622 return err; 621 623 ··· 4567 4565 u32 ifa_flags; 4568 4566 int err; 4569 4567 4570 - err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv6_policy, 4571 - extack); 4568 + err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, 4569 + ifa_ipv6_policy, extack); 4572 4570 if (err < 0) 4573 4571 return err; 4574 4572 ··· 4731 4729 struct ifa6_config cfg; 4732 4730 int err; 4733 4731 4734 - err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv6_policy, 4735 - extack); 4732 + err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, 4733 + ifa_ipv6_policy, extack); 4736 4734 if (err < 0) 4737 4735 return err; 4738 4736 ··· 5088 5086 fillargs->flags |= NLM_F_DUMP_FILTERED; 5089 5087 } 5090 5088 5091 - err = nlmsg_parse_strict(nlh, sizeof(*ifm), tb, IFA_MAX, 5092 - ifa_ipv6_policy, extack); 5089 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(*ifm), tb, IFA_MAX, 5090 + ifa_ipv6_policy, extack); 5093 5091 if (err < 0) 5094 5092 return err; 5095 5093 ··· 5239 5237 } 5240 5238 5241 5239 if (!netlink_strict_get_check(skb)) 5242 - return nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, 5243 - ifa_ipv6_policy, extack); 5240 + return nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, 5241 + ifa_ipv6_policy, extack); 5244 5242 5245 - err = nlmsg_parse_strict(nlh, sizeof(*ifm), tb, IFA_MAX, 5246 - ifa_ipv6_policy, extack); 5243 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(*ifm), tb, IFA_MAX, 5244 + ifa_ipv6_policy, extack); 5247 5245 if (err) 5248 5246 return err; 5249 5247 ··· 5669 5667 if (dev && !__in6_dev_get(dev)) 5670 5668 return -EAFNOSUPPORT; 5671 5669 5672 - return nla_parse_nested(tb, IFLA_INET6_MAX, nla, inet6_af_policy, 5673 - NULL); 5670 + return nla_parse_nested_deprecated(tb, IFLA_INET6_MAX, nla, 5671 + inet6_af_policy, NULL); 5674 5672 } 5675 5673 5676 5674 static int check_addr_gen_mode(int mode) ··· 5702 5700 if (!idev) 5703 5701 return -EAFNOSUPPORT; 5704 5702 5705 - if (nla_parse_nested(tb, IFLA_INET6_MAX, nla, NULL, NULL) < 0) 5703 + if (nla_parse_nested_deprecated(tb, IFLA_INET6_MAX, nla, NULL, NULL) < 0) 5706 5704 BUG(); 5707 5705 5708 5706 if (tb[IFLA_INET6_TOKEN]) {
+6 -6
net/ipv6/addrlabel.c
··· 383 383 u32 label; 384 384 int err = 0; 385 385 386 - err = nlmsg_parse(nlh, sizeof(*ifal), tb, IFAL_MAX, ifal_policy, 387 - extack); 386 + err = nlmsg_parse_deprecated(nlh, sizeof(*ifal), tb, IFAL_MAX, 387 + ifal_policy, extack); 388 388 if (err < 0) 389 389 return err; 390 390 ··· 537 537 } 538 538 539 539 if (!netlink_strict_get_check(skb)) 540 - return nlmsg_parse(nlh, sizeof(*ifal), tb, IFAL_MAX, 541 - ifal_policy, extack); 540 + return nlmsg_parse_deprecated(nlh, sizeof(*ifal), tb, 541 + IFAL_MAX, ifal_policy, extack); 542 542 543 543 ifal = nlmsg_data(nlh); 544 544 if (ifal->__ifal_reserved || ifal->ifal_flags || ifal->ifal_seq) { ··· 546 546 return -EINVAL; 547 547 } 548 548 549 - err = nlmsg_parse_strict(nlh, sizeof(*ifal), tb, IFAL_MAX, 550 - ifal_policy, extack); 549 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(*ifal), tb, IFAL_MAX, 550 + ifal_policy, extack); 551 551 if (err) 552 552 return err; 553 553
+2 -1
net/ipv6/ila/ila_lwt.c
··· 146 146 if (family != AF_INET6) 147 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 151 if (ret < 0) 151 152 return ret; 152 153
+6 -6
net/ipv6/route.c
··· 4239 4239 unsigned int pref; 4240 4240 int err; 4241 4241 4242 - err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy, 4243 - extack); 4242 + err = nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, 4243 + rtm_ipv6_policy, extack); 4244 4244 if (err < 0) 4245 4245 goto errout; 4246 4246 ··· 4886 4886 } 4887 4887 4888 4888 if (!netlink_strict_get_check(skb)) 4889 - return nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, 4890 - rtm_ipv6_policy, extack); 4889 + return nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, 4890 + rtm_ipv6_policy, extack); 4891 4891 4892 4892 rtm = nlmsg_data(nlh); 4893 4893 if ((rtm->rtm_src_len && rtm->rtm_src_len != 128) || ··· 4903 4903 return -EINVAL; 4904 4904 } 4905 4905 4906 - err = nlmsg_parse_strict(nlh, sizeof(*rtm), tb, RTA_MAX, 4907 - rtm_ipv6_policy, extack); 4906 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(*rtm), tb, RTA_MAX, 4907 + rtm_ipv6_policy, extack); 4908 4908 if (err) 4909 4909 return err; 4910 4910
+2 -2
net/ipv6/seg6_iptunnel.c
··· 396 396 if (family != AF_INET && family != AF_INET6) 397 397 return -EINVAL; 398 398 399 - err = nla_parse_nested(tb, SEG6_IPTUNNEL_MAX, nla, 400 - seg6_iptunnel_policy, extack); 399 + err = nla_parse_nested_deprecated(tb, SEG6_IPTUNNEL_MAX, nla, 400 + seg6_iptunnel_policy, extack); 401 401 402 402 if (err < 0) 403 403 return err;
+5 -4
net/ipv6/seg6_local.c
··· 823 823 int ret; 824 824 u32 fd; 825 825 826 - ret = nla_parse_nested(tb, SEG6_LOCAL_BPF_PROG_MAX, 827 - attrs[SEG6_LOCAL_BPF], bpf_prog_policy, NULL); 826 + ret = nla_parse_nested_deprecated(tb, SEG6_LOCAL_BPF_PROG_MAX, 827 + attrs[SEG6_LOCAL_BPF], 828 + bpf_prog_policy, NULL); 828 829 if (ret < 0) 829 830 return ret; 830 831 ··· 960 959 if (family != AF_INET6) 961 960 return -EINVAL; 962 961 963 - err = nla_parse_nested(tb, SEG6_LOCAL_MAX, nla, seg6_local_policy, 964 - extack); 962 + err = nla_parse_nested_deprecated(tb, SEG6_LOCAL_MAX, nla, 963 + seg6_local_policy, extack); 965 964 966 965 if (err < 0) 967 966 return err;
+14 -12
net/mpls/af_mpls.c
··· 1223 1223 } 1224 1224 1225 1225 if (!netlink_strict_get_check(skb)) 1226 - return nlmsg_parse(nlh, sizeof(struct netconfmsg), tb, 1227 - NETCONFA_MAX, devconf_mpls_policy, extack); 1226 + return nlmsg_parse_deprecated(nlh, sizeof(struct netconfmsg), 1227 + tb, NETCONFA_MAX, 1228 + devconf_mpls_policy, extack); 1228 1229 1229 - err = nlmsg_parse_strict(nlh, sizeof(struct netconfmsg), tb, 1230 - NETCONFA_MAX, devconf_mpls_policy, extack); 1230 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct netconfmsg), 1231 + tb, NETCONFA_MAX, 1232 + devconf_mpls_policy, extack); 1231 1233 if (err) 1232 1234 return err; 1233 1235 ··· 1790 1788 int index; 1791 1789 int err; 1792 1790 1793 - err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_mpls_policy, 1794 - extack); 1791 + err = nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, 1792 + rtm_mpls_policy, extack); 1795 1793 if (err < 0) 1796 1794 goto errout; 1797 1795 ··· 2108 2106 cb->answer_flags = NLM_F_DUMP_FILTERED; 2109 2107 } 2110 2108 2111 - err = nlmsg_parse_strict(nlh, sizeof(*rtm), tb, RTA_MAX, 2112 - rtm_mpls_policy, extack); 2109 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(*rtm), tb, RTA_MAX, 2110 + rtm_mpls_policy, extack); 2113 2111 if (err < 0) 2114 2112 return err; 2115 2113 ··· 2292 2290 } 2293 2291 2294 2292 if (!netlink_strict_get_check(skb)) 2295 - return nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, 2296 - rtm_mpls_policy, extack); 2293 + return nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, 2294 + rtm_mpls_policy, extack); 2297 2295 2298 2296 rtm = nlmsg_data(nlh); 2299 2297 if ((rtm->rtm_dst_len && rtm->rtm_dst_len != 20) || ··· 2308 2306 return -EINVAL; 2309 2307 } 2310 2308 2311 - err = nlmsg_parse_strict(nlh, sizeof(*rtm), tb, RTA_MAX, 2312 - rtm_mpls_policy, extack); 2309 + err = nlmsg_parse_deprecated_strict(nlh, sizeof(*rtm), tb, RTA_MAX, 2310 + rtm_mpls_policy, extack); 2313 2311 if (err) 2314 2312 return err; 2315 2313
+2 -2
net/mpls/mpls_iptunnel.c
··· 178 178 u8 n_labels; 179 179 int ret; 180 180 181 - ret = nla_parse_nested(tb, MPLS_IPTUNNEL_MAX, nla, 182 - mpls_iptunnel_policy, extack); 181 + ret = nla_parse_nested_deprecated(tb, MPLS_IPTUNNEL_MAX, nla, 182 + mpls_iptunnel_policy, extack); 183 183 if (ret < 0) 184 184 return ret; 185 185
+2 -2
net/ncsi/ncsi-netlink.c
··· 220 220 void *hdr; 221 221 int rc; 222 222 223 - rc = genlmsg_parse(cb->nlh, &ncsi_genl_family, attrs, NCSI_ATTR_MAX, 224 - ncsi_genl_policy, NULL); 223 + rc = genlmsg_parse_deprecated(cb->nlh, &ncsi_genl_family, attrs, NCSI_ATTR_MAX, 224 + ncsi_genl_policy, NULL); 225 225 if (rc) 226 226 return rc; 227 227
+14 -22
net/netfilter/ipset/ip_set_core.c
··· 299 299 300 300 if (unlikely(!flag_nested(nla))) 301 301 return -IPSET_ERR_PROTOCOL; 302 - if (nla_parse_nested(tb, IPSET_ATTR_IPADDR_MAX, nla, 303 - ipaddr_policy, NULL)) 302 + if (nla_parse_nested_deprecated(tb, IPSET_ATTR_IPADDR_MAX, nla, ipaddr_policy, NULL)) 304 303 return -IPSET_ERR_PROTOCOL; 305 304 if (unlikely(!ip_set_attr_netorder(tb, IPSET_ATTR_IPADDR_IPV4))) 306 305 return -IPSET_ERR_PROTOCOL; ··· 317 318 if (unlikely(!flag_nested(nla))) 318 319 return -IPSET_ERR_PROTOCOL; 319 320 320 - if (nla_parse_nested(tb, IPSET_ATTR_IPADDR_MAX, nla, 321 - ipaddr_policy, NULL)) 321 + if (nla_parse_nested_deprecated(tb, IPSET_ATTR_IPADDR_MAX, nla, ipaddr_policy, NULL)) 322 322 return -IPSET_ERR_PROTOCOL; 323 323 if (unlikely(!ip_set_attr_netorder(tb, IPSET_ATTR_IPADDR_IPV6))) 324 324 return -IPSET_ERR_PROTOCOL; ··· 937 939 938 940 /* Without holding any locks, create private part. */ 939 941 if (attr[IPSET_ATTR_DATA] && 940 - nla_parse_nested(tb, IPSET_ATTR_CREATE_MAX, attr[IPSET_ATTR_DATA], 941 - set->type->create_policy, NULL)) { 942 + nla_parse_nested_deprecated(tb, IPSET_ATTR_CREATE_MAX, attr[IPSET_ATTR_DATA], set->type->create_policy, NULL)) { 942 943 ret = -IPSET_ERR_PROTOCOL; 943 944 goto put_out; 944 945 } ··· 1295 1298 ip_set_id_t index; 1296 1299 1297 1300 /* Second pass, so parser can't fail */ 1298 - nla_parse(cda, IPSET_ATTR_CMD_MAX, attr, nlh->nlmsg_len - min_len, 1299 - ip_set_setname_policy, NULL); 1301 + nla_parse_deprecated(cda, IPSET_ATTR_CMD_MAX, attr, 1302 + nlh->nlmsg_len - min_len, ip_set_setname_policy, 1303 + NULL); 1300 1304 1301 1305 cb->args[IPSET_CB_PROTO] = nla_get_u8(cda[IPSET_ATTR_PROTOCOL]); 1302 1306 if (cda[IPSET_ATTR_SETNAME]) { ··· 1544 1546 memcpy(&errmsg->msg, nlh, nlh->nlmsg_len); 1545 1547 cmdattr = (void *)&errmsg->msg + min_len; 1546 1548 1547 - nla_parse(cda, IPSET_ATTR_CMD_MAX, cmdattr, 1548 - nlh->nlmsg_len - min_len, ip_set_adt_policy, NULL); 1549 + nla_parse_deprecated(cda, IPSET_ATTR_CMD_MAX, cmdattr, 1550 + nlh->nlmsg_len - min_len, 1551 + ip_set_adt_policy, NULL); 1549 1552 1550 1553 errline = nla_data(cda[IPSET_ATTR_LINENO]); 1551 1554 ··· 1591 1592 1592 1593 use_lineno = !!attr[IPSET_ATTR_LINENO]; 1593 1594 if (attr[IPSET_ATTR_DATA]) { 1594 - if (nla_parse_nested(tb, IPSET_ATTR_ADT_MAX, 1595 - attr[IPSET_ATTR_DATA], 1596 - set->type->adt_policy, NULL)) 1595 + if (nla_parse_nested_deprecated(tb, IPSET_ATTR_ADT_MAX, attr[IPSET_ATTR_DATA], set->type->adt_policy, NULL)) 1597 1596 return -IPSET_ERR_PROTOCOL; 1598 1597 ret = call_ad(ctnl, skb, set, tb, IPSET_ADD, flags, 1599 1598 use_lineno); ··· 1602 1605 memset(tb, 0, sizeof(tb)); 1603 1606 if (nla_type(nla) != IPSET_ATTR_DATA || 1604 1607 !flag_nested(nla) || 1605 - nla_parse_nested(tb, IPSET_ATTR_ADT_MAX, nla, 1606 - set->type->adt_policy, NULL)) 1608 + nla_parse_nested_deprecated(tb, IPSET_ATTR_ADT_MAX, nla, set->type->adt_policy, NULL)) 1607 1609 return -IPSET_ERR_PROTOCOL; 1608 1610 ret = call_ad(ctnl, skb, set, tb, IPSET_ADD, 1609 1611 flags, use_lineno); ··· 1643 1647 1644 1648 use_lineno = !!attr[IPSET_ATTR_LINENO]; 1645 1649 if (attr[IPSET_ATTR_DATA]) { 1646 - if (nla_parse_nested(tb, IPSET_ATTR_ADT_MAX, 1647 - attr[IPSET_ATTR_DATA], 1648 - set->type->adt_policy, NULL)) 1650 + if (nla_parse_nested_deprecated(tb, IPSET_ATTR_ADT_MAX, attr[IPSET_ATTR_DATA], set->type->adt_policy, NULL)) 1649 1651 return -IPSET_ERR_PROTOCOL; 1650 1652 ret = call_ad(ctnl, skb, set, tb, IPSET_DEL, flags, 1651 1653 use_lineno); ··· 1654 1660 memset(tb, 0, sizeof(*tb)); 1655 1661 if (nla_type(nla) != IPSET_ATTR_DATA || 1656 1662 !flag_nested(nla) || 1657 - nla_parse_nested(tb, IPSET_ATTR_ADT_MAX, nla, 1658 - set->type->adt_policy, NULL)) 1663 + nla_parse_nested_deprecated(tb, IPSET_ATTR_ADT_MAX, nla, set->type->adt_policy, NULL)) 1659 1664 return -IPSET_ERR_PROTOCOL; 1660 1665 ret = call_ad(ctnl, skb, set, tb, IPSET_DEL, 1661 1666 flags, use_lineno); ··· 1685 1692 if (!set) 1686 1693 return -ENOENT; 1687 1694 1688 - if (nla_parse_nested(tb, IPSET_ATTR_ADT_MAX, attr[IPSET_ATTR_DATA], 1689 - set->type->adt_policy, NULL)) 1695 + if (nla_parse_nested_deprecated(tb, IPSET_ATTR_ADT_MAX, attr[IPSET_ATTR_DATA], set->type->adt_policy, NULL)) 1690 1696 return -IPSET_ERR_PROTOCOL; 1691 1697 1692 1698 rcu_read_lock_bh();
+4 -9
net/netfilter/ipvs/ip_vs_ctl.c
··· 3116 3116 3117 3117 /* Parse mandatory identifying service fields first */ 3118 3118 if (nla == NULL || 3119 - nla_parse_nested(attrs, IPVS_SVC_ATTR_MAX, nla, 3120 - ip_vs_svc_policy, NULL)) 3119 + nla_parse_nested_deprecated(attrs, IPVS_SVC_ATTR_MAX, nla, ip_vs_svc_policy, NULL)) 3121 3120 return -EINVAL; 3122 3121 3123 3122 nla_af = attrs[IPVS_SVC_ATTR_AF]; ··· 3278 3279 mutex_lock(&__ip_vs_mutex); 3279 3280 3280 3281 /* Try to find the service for which to dump destinations */ 3281 - if (nlmsg_parse(cb->nlh, GENL_HDRLEN, attrs, IPVS_CMD_ATTR_MAX, 3282 - ip_vs_cmd_policy, cb->extack)) 3282 + if (nlmsg_parse_deprecated(cb->nlh, GENL_HDRLEN, attrs, IPVS_CMD_ATTR_MAX, ip_vs_cmd_policy, cb->extack)) 3283 3283 goto out_err; 3284 3284 3285 3285 ··· 3314 3316 3315 3317 /* Parse mandatory identifying destination fields first */ 3316 3318 if (nla == NULL || 3317 - nla_parse_nested(attrs, IPVS_DEST_ATTR_MAX, nla, 3318 - ip_vs_dest_policy, NULL)) 3319 + nla_parse_nested_deprecated(attrs, IPVS_DEST_ATTR_MAX, nla, ip_vs_dest_policy, NULL)) 3319 3320 return -EINVAL; 3320 3321 3321 3322 nla_addr = attrs[IPVS_DEST_ATTR_ADDR]; ··· 3558 3561 struct nlattr *daemon_attrs[IPVS_DAEMON_ATTR_MAX + 1]; 3559 3562 3560 3563 if (!info->attrs[IPVS_CMD_ATTR_DAEMON] || 3561 - nla_parse_nested(daemon_attrs, IPVS_DAEMON_ATTR_MAX, 3562 - info->attrs[IPVS_CMD_ATTR_DAEMON], 3563 - ip_vs_daemon_policy, info->extack)) 3564 + nla_parse_nested_deprecated(daemon_attrs, IPVS_DAEMON_ATTR_MAX, info->attrs[IPVS_CMD_ATTR_DAEMON], ip_vs_daemon_policy, info->extack)) 3564 3565 goto out; 3565 3566 3566 3567 if (cmd == IPVS_CMD_NEW_DAEMON)
+25 -20
net/netfilter/nf_conntrack_netlink.c
··· 1020 1020 struct nlattr *tb[CTA_IP_MAX+1]; 1021 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 1024 if (ret < 0) 1025 1025 return ret; 1026 1026 1027 - ret = nla_validate_nested(attr, CTA_IP_MAX, 1028 - cta_ip_nla_policy, NULL); 1027 + ret = nla_validate_nested_deprecated(attr, CTA_IP_MAX, 1028 + cta_ip_nla_policy, NULL); 1029 1029 if (ret) 1030 1030 return ret; 1031 1031 ··· 1052 1052 struct nlattr *tb[CTA_PROTO_MAX+1]; 1053 1053 int ret = 0; 1054 1054 1055 - ret = nla_parse_nested(tb, CTA_PROTO_MAX, attr, proto_nla_policy, 1056 - NULL); 1055 + ret = nla_parse_nested_deprecated(tb, CTA_PROTO_MAX, attr, 1056 + proto_nla_policy, NULL); 1057 1057 if (ret < 0) 1058 1058 return ret; 1059 1059 ··· 1065 1065 l4proto = nf_ct_l4proto_find(tuple->dst.protonum); 1066 1066 1067 1067 if (likely(l4proto->nlattr_to_tuple)) { 1068 - ret = nla_validate_nested(attr, CTA_PROTO_MAX, 1069 - l4proto->nla_policy, NULL); 1068 + ret = nla_validate_nested_deprecated(attr, CTA_PROTO_MAX, 1069 + l4proto->nla_policy, 1070 + NULL); 1070 1071 if (ret == 0) 1071 1072 ret = l4proto->nlattr_to_tuple(tb, tuple); 1072 1073 } ··· 1130 1129 1131 1130 memset(tuple, 0, sizeof(*tuple)); 1132 1131 1133 - err = nla_parse_nested(tb, CTA_TUPLE_MAX, cda[type], tuple_nla_policy, 1134 - NULL); 1132 + err = nla_parse_nested_deprecated(tb, CTA_TUPLE_MAX, cda[type], 1133 + tuple_nla_policy, NULL); 1135 1134 if (err < 0) 1136 1135 return err; 1137 1136 ··· 1181 1180 int err; 1182 1181 struct nlattr *tb[CTA_HELP_MAX+1]; 1183 1182 1184 - err = nla_parse_nested(tb, CTA_HELP_MAX, attr, help_nla_policy, NULL); 1183 + err = nla_parse_nested_deprecated(tb, CTA_HELP_MAX, attr, 1184 + help_nla_policy, NULL); 1185 1185 if (err < 0) 1186 1186 return err; 1187 1187 ··· 1723 1721 struct nlattr *tb[CTA_PROTOINFO_MAX+1]; 1724 1722 int err = 0; 1725 1723 1726 - err = nla_parse_nested(tb, CTA_PROTOINFO_MAX, attr, protoinfo_policy, 1727 - NULL); 1724 + err = nla_parse_nested_deprecated(tb, CTA_PROTOINFO_MAX, attr, 1725 + protoinfo_policy, NULL); 1728 1726 if (err < 0) 1729 1727 return err; 1730 1728 ··· 1747 1745 int err; 1748 1746 struct nlattr *cda[CTA_SEQADJ_MAX+1]; 1749 1747 1750 - err = nla_parse_nested(cda, CTA_SEQADJ_MAX, attr, seqadj_policy, NULL); 1748 + err = nla_parse_nested_deprecated(cda, CTA_SEQADJ_MAX, attr, 1749 + seqadj_policy, NULL); 1751 1750 if (err < 0) 1752 1751 return err; 1753 1752 ··· 1825 1822 if (!synproxy) 1826 1823 return 0; 1827 1824 1828 - err = nla_parse_nested(tb, CTA_SYNPROXY_MAX, cda[CTA_SYNPROXY], 1829 - synproxy_policy, NULL); 1825 + err = nla_parse_nested_deprecated(tb, CTA_SYNPROXY_MAX, 1826 + cda[CTA_SYNPROXY], synproxy_policy, 1827 + NULL); 1830 1828 if (err < 0) 1831 1829 return err; 1832 1830 ··· 2557 2553 struct nlattr *cda[CTA_MAX+1]; 2558 2554 int ret; 2559 2555 2560 - ret = nla_parse_nested(cda, CTA_MAX, attr, ct_nla_policy, NULL); 2556 + ret = nla_parse_nested_deprecated(cda, CTA_MAX, attr, ct_nla_policy, 2557 + NULL); 2561 2558 if (ret < 0) 2562 2559 return ret; 2563 2560 ··· 2591 2586 struct nf_conntrack_expect *exp; 2592 2587 int err; 2593 2588 2594 - err = nla_parse_nested(cda, CTA_EXPECT_MAX, attr, exp_nla_policy, 2595 - NULL); 2589 + err = nla_parse_nested_deprecated(cda, CTA_EXPECT_MAX, attr, 2590 + exp_nla_policy, NULL); 2596 2591 if (err < 0) 2597 2592 return err; 2598 2593 ··· 3214 3209 struct nf_conntrack_tuple nat_tuple = {}; 3215 3210 int err; 3216 3211 3217 - err = nla_parse_nested(tb, CTA_EXPECT_NAT_MAX, attr, 3218 - exp_nat_nla_policy, NULL); 3212 + err = nla_parse_nested_deprecated(tb, CTA_EXPECT_NAT_MAX, attr, 3213 + exp_nat_nla_policy, NULL); 3219 3214 if (err < 0) 3220 3215 return err; 3221 3216
+2 -2
net/netfilter/nf_conntrack_proto_dccp.c
··· 639 639 if (!attr) 640 640 return 0; 641 641 642 - err = nla_parse_nested(tb, CTA_PROTOINFO_DCCP_MAX, attr, 643 - dccp_nla_policy, NULL); 642 + err = nla_parse_nested_deprecated(tb, CTA_PROTOINFO_DCCP_MAX, attr, 643 + dccp_nla_policy, NULL); 644 644 if (err < 0) 645 645 return err; 646 646
+2 -2
net/netfilter/nf_conntrack_proto_sctp.c
··· 563 563 if (!attr) 564 564 return 0; 565 565 566 - err = nla_parse_nested(tb, CTA_PROTOINFO_SCTP_MAX, attr, 567 - sctp_nla_policy, NULL); 566 + err = nla_parse_nested_deprecated(tb, CTA_PROTOINFO_SCTP_MAX, attr, 567 + sctp_nla_policy, NULL); 568 568 if (err < 0) 569 569 return err; 570 570
+2 -2
net/netfilter/nf_conntrack_proto_tcp.c
··· 1248 1248 if (!pattr) 1249 1249 return 0; 1250 1250 1251 - err = nla_parse_nested(tb, CTA_PROTOINFO_TCP_MAX, pattr, 1252 - tcp_nla_policy, NULL); 1251 + err = nla_parse_nested_deprecated(tb, CTA_PROTOINFO_TCP_MAX, pattr, 1252 + tcp_nla_policy, NULL); 1253 1253 if (err < 0) 1254 1254 return err; 1255 1255
+4 -3
net/netfilter/nf_nat_core.c
··· 890 890 struct nlattr *tb[CTA_PROTONAT_MAX+1]; 891 891 int err; 892 892 893 - err = nla_parse_nested(tb, CTA_PROTONAT_MAX, attr, 894 - protonat_nla_policy, NULL); 893 + err = nla_parse_nested_deprecated(tb, CTA_PROTONAT_MAX, attr, 894 + protonat_nla_policy, NULL); 895 895 if (err < 0) 896 896 return err; 897 897 ··· 949 949 950 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 954 if (err < 0) 954 955 return err; 955 956
+26 -22
net/netfilter/nf_tables_api.c
··· 1420 1420 struct nft_stats *stats; 1421 1421 int err; 1422 1422 1423 - err = nla_parse_nested(tb, NFTA_COUNTER_MAX, attr, nft_counter_policy, 1424 - NULL); 1423 + err = nla_parse_nested_deprecated(tb, NFTA_COUNTER_MAX, attr, 1424 + nft_counter_policy, NULL); 1425 1425 if (err < 0) 1426 1426 return ERR_PTR(err); 1427 1427 ··· 1525 1525 lockdep_assert_held(&net->nft.commit_mutex); 1526 1526 lockdep_nfnl_nft_mutex_not_held(); 1527 1527 1528 - err = nla_parse_nested(ha, NFTA_HOOK_MAX, nla[NFTA_CHAIN_HOOK], 1529 - nft_hook_policy, NULL); 1528 + err = nla_parse_nested_deprecated(ha, NFTA_HOOK_MAX, 1529 + nla[NFTA_CHAIN_HOOK], 1530 + nft_hook_policy, NULL); 1530 1531 if (err < 0) 1531 1532 return err; 1532 1533 ··· 2106 2105 struct nlattr *tb[NFTA_EXPR_MAX + 1]; 2107 2106 int err; 2108 2107 2109 - err = nla_parse_nested(tb, NFTA_EXPR_MAX, nla, nft_expr_policy, NULL); 2108 + err = nla_parse_nested_deprecated(tb, NFTA_EXPR_MAX, nla, 2109 + nft_expr_policy, NULL); 2110 2110 if (err < 0) 2111 2111 return err; 2112 2112 ··· 2116 2114 return PTR_ERR(type); 2117 2115 2118 2116 if (tb[NFTA_EXPR_DATA]) { 2119 - err = nla_parse_nested(info->tb, type->maxattr, 2120 - tb[NFTA_EXPR_DATA], type->policy, NULL); 2117 + err = nla_parse_nested_deprecated(info->tb, type->maxattr, 2118 + tb[NFTA_EXPR_DATA], 2119 + type->policy, NULL); 2121 2120 if (err < 0) 2122 2121 goto err1; 2123 2122 } else ··· 3446 3443 struct nlattr *da[NFTA_SET_DESC_MAX + 1]; 3447 3444 int err; 3448 3445 3449 - err = nla_parse_nested(da, NFTA_SET_DESC_MAX, nla, 3450 - nft_set_desc_policy, NULL); 3446 + err = nla_parse_nested_deprecated(da, NFTA_SET_DESC_MAX, nla, 3447 + nft_set_desc_policy, NULL); 3451 3448 if (err < 0) 3452 3449 return err; 3453 3450 ··· 4173 4170 void *priv; 4174 4171 int err; 4175 4172 4176 - err = nla_parse_nested(nla, NFTA_SET_ELEM_MAX, attr, 4177 - nft_set_elem_policy, NULL); 4173 + err = nla_parse_nested_deprecated(nla, NFTA_SET_ELEM_MAX, attr, 4174 + nft_set_elem_policy, NULL); 4178 4175 if (err < 0) 4179 4176 return err; 4180 4177 ··· 4405 4402 u8 ulen; 4406 4403 int err; 4407 4404 4408 - err = nla_parse_nested(nla, NFTA_SET_ELEM_MAX, attr, 4409 - nft_set_elem_policy, NULL); 4405 + err = nla_parse_nested_deprecated(nla, NFTA_SET_ELEM_MAX, attr, 4406 + nft_set_elem_policy, NULL); 4410 4407 if (err < 0) 4411 4408 return err; 4412 4409 ··· 4699 4696 void *priv; 4700 4697 int err; 4701 4698 4702 - err = nla_parse_nested(nla, NFTA_SET_ELEM_MAX, attr, 4703 - nft_set_elem_policy, NULL); 4699 + err = nla_parse_nested_deprecated(nla, NFTA_SET_ELEM_MAX, attr, 4700 + nft_set_elem_policy, NULL); 4704 4701 if (err < 0) 4705 4702 goto err1; 4706 4703 ··· 4974 4971 goto err1; 4975 4972 4976 4973 if (attr) { 4977 - err = nla_parse_nested(tb, type->maxattr, attr, type->policy, 4978 - NULL); 4974 + err = nla_parse_nested_deprecated(tb, type->maxattr, attr, 4975 + type->policy, NULL); 4979 4976 if (err < 0) 4980 4977 goto err2; 4981 4978 } else { ··· 5551 5548 int hooknum, priority; 5552 5549 int err, n = 0, i; 5553 5550 5554 - err = nla_parse_nested(tb, NFTA_FLOWTABLE_HOOK_MAX, attr, 5555 - nft_flowtable_hook_policy, NULL); 5551 + err = nla_parse_nested_deprecated(tb, NFTA_FLOWTABLE_HOOK_MAX, attr, 5552 + nft_flowtable_hook_policy, NULL); 5556 5553 if (err < 0) 5557 5554 return err; 5558 5555 ··· 7209 7206 struct nft_chain *chain; 7210 7207 int err; 7211 7208 7212 - err = nla_parse_nested(tb, NFTA_VERDICT_MAX, nla, nft_verdict_policy, 7213 - NULL); 7209 + err = nla_parse_nested_deprecated(tb, NFTA_VERDICT_MAX, nla, 7210 + nft_verdict_policy, NULL); 7214 7211 if (err < 0) 7215 7212 return err; 7216 7213 ··· 7340 7337 struct nlattr *tb[NFTA_DATA_MAX + 1]; 7341 7338 int err; 7342 7339 7343 - err = nla_parse_nested(tb, NFTA_DATA_MAX, nla, nft_data_policy, NULL); 7340 + err = nla_parse_nested_deprecated(tb, NFTA_DATA_MAX, nla, 7341 + nft_data_policy, NULL); 7344 7342 if (err < 0) 7345 7343 return err; 7346 7344
+9 -6
net/netfilter/nfnetlink.c
··· 206 206 return -ENOMEM; 207 207 } 208 208 209 - err = nla_parse(cda, ss->cb[cb_id].attr_count, attr, attrlen, 210 - ss->cb[cb_id].policy, extack); 209 + err = nla_parse_deprecated(cda, ss->cb[cb_id].attr_count, 210 + attr, attrlen, 211 + ss->cb[cb_id].policy, extack); 211 212 if (err < 0) { 212 213 rcu_read_unlock(); 213 214 return err; ··· 422 421 goto ack; 423 422 } 424 423 425 - err = nla_parse(cda, ss->cb[cb_id].attr_count, attr, 426 - attrlen, ss->cb[cb_id].policy, NULL); 424 + err = nla_parse_deprecated(cda, 425 + ss->cb[cb_id].attr_count, 426 + attr, attrlen, 427 + ss->cb[cb_id].policy, NULL); 427 428 if (err < 0) 428 429 goto ack; 429 430 ··· 523 520 if (skb->len < NLMSG_HDRLEN + sizeof(struct nfgenmsg)) 524 521 return; 525 522 526 - err = nla_parse(cda, NFNL_BATCH_MAX, attr, attrlen, nfnl_batch_policy, 527 - NULL); 523 + err = nla_parse_deprecated(cda, NFNL_BATCH_MAX, attr, attrlen, 524 + nfnl_batch_policy, NULL); 528 525 if (err < 0) { 529 526 netlink_ack(skb, nlh, err, NULL); 530 527 return;
+2 -2
net/netfilter/nft_compat.c
··· 198 198 u32 flags; 199 199 int err; 200 200 201 - err = nla_parse_nested(tb, NFTA_RULE_COMPAT_MAX, attr, 202 - nft_rule_compat_policy, NULL); 201 + err = nla_parse_nested_deprecated(tb, NFTA_RULE_COMPAT_MAX, attr, 202 + nft_rule_compat_policy, NULL); 203 203 if (err < 0) 204 204 return err; 205 205
+5 -3
net/netfilter/nft_ct.c
··· 797 797 if (!tb) 798 798 return -ENOMEM; 799 799 800 - ret = nla_parse_nested(tb, l4proto->ctnl_timeout.nlattr_max, 801 - attr, l4proto->ctnl_timeout.nla_policy, 802 - NULL); 800 + ret = nla_parse_nested_deprecated(tb, 801 + l4proto->ctnl_timeout.nlattr_max, 802 + attr, 803 + l4proto->ctnl_timeout.nla_policy, 804 + NULL); 803 805 if (ret < 0) 804 806 goto err; 805 807
+11 -10
net/netfilter/nft_tunnel.c
··· 166 166 struct nlattr *tb[NFTA_TUNNEL_KEY_IP_MAX + 1]; 167 167 int err; 168 168 169 - err = nla_parse_nested(tb, NFTA_TUNNEL_KEY_IP_MAX, attr, 170 - nft_tunnel_ip_policy, NULL); 169 + err = nla_parse_nested_deprecated(tb, NFTA_TUNNEL_KEY_IP_MAX, attr, 170 + nft_tunnel_ip_policy, NULL); 171 171 if (err < 0) 172 172 return err; 173 173 ··· 195 195 struct nlattr *tb[NFTA_TUNNEL_KEY_IP6_MAX + 1]; 196 196 int err; 197 197 198 - err = nla_parse_nested(tb, NFTA_TUNNEL_KEY_IP6_MAX, attr, 199 - nft_tunnel_ip6_policy, NULL); 198 + err = nla_parse_nested_deprecated(tb, NFTA_TUNNEL_KEY_IP6_MAX, attr, 199 + nft_tunnel_ip6_policy, NULL); 200 200 if (err < 0) 201 201 return err; 202 202 ··· 231 231 struct nlattr *tb[NFTA_TUNNEL_KEY_VXLAN_MAX + 1]; 232 232 int err; 233 233 234 - err = nla_parse_nested(tb, NFTA_TUNNEL_KEY_VXLAN_MAX, attr, 235 - nft_tunnel_opts_vxlan_policy, NULL); 234 + err = nla_parse_nested_deprecated(tb, NFTA_TUNNEL_KEY_VXLAN_MAX, attr, 235 + nft_tunnel_opts_vxlan_policy, NULL); 236 236 if (err < 0) 237 237 return err; 238 238 ··· 260 260 uint8_t hwid, dir; 261 261 int err, version; 262 262 263 - err = nla_parse_nested(tb, NFTA_TUNNEL_KEY_ERSPAN_MAX, attr, 264 - nft_tunnel_opts_erspan_policy, NULL); 263 + err = nla_parse_nested_deprecated(tb, NFTA_TUNNEL_KEY_ERSPAN_MAX, 264 + attr, nft_tunnel_opts_erspan_policy, 265 + NULL); 265 266 if (err < 0) 266 267 return err; 267 268 ··· 310 309 struct nlattr *tb[NFTA_TUNNEL_KEY_OPTS_MAX + 1]; 311 310 int err; 312 311 313 - err = nla_parse_nested(tb, NFTA_TUNNEL_KEY_OPTS_MAX, attr, 314 - nft_tunnel_opts_policy, NULL); 312 + err = nla_parse_nested_deprecated(tb, NFTA_TUNNEL_KEY_OPTS_MAX, attr, 313 + nft_tunnel_opts_policy, NULL); 315 314 if (err < 0) 316 315 return err; 317 316
+20 -16
net/netlabel/netlabel_cipso_v4.c
··· 99 99 100 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], 103 - NLBL_CIPSOV4_A_MAX, 104 - netlbl_cipsov4_genl_policy, NULL) != 0) 102 + if (nla_validate_nested_deprecated(info->attrs[NLBL_CIPSOV4_A_TAGLST], 103 + NLBL_CIPSOV4_A_MAX, 104 + netlbl_cipsov4_genl_policy, 105 + NULL) != 0) 105 106 return -EINVAL; 106 107 107 108 nla_for_each_nested(nla, info->attrs[NLBL_CIPSOV4_A_TAGLST], nla_rem) ··· 147 146 !info->attrs[NLBL_CIPSOV4_A_MLSLVLLST]) 148 147 return -EINVAL; 149 148 150 - if (nla_validate_nested(info->attrs[NLBL_CIPSOV4_A_MLSLVLLST], 151 - NLBL_CIPSOV4_A_MAX, 152 - netlbl_cipsov4_genl_policy, NULL) != 0) 149 + if (nla_validate_nested_deprecated(info->attrs[NLBL_CIPSOV4_A_MLSLVLLST], 150 + NLBL_CIPSOV4_A_MAX, 151 + netlbl_cipsov4_genl_policy, 152 + NULL) != 0) 153 153 return -EINVAL; 154 154 155 155 doi_def = kmalloc(sizeof(*doi_def), GFP_KERNEL); ··· 172 170 info->attrs[NLBL_CIPSOV4_A_MLSLVLLST], 173 171 nla_a_rem) 174 172 if (nla_type(nla_a) == NLBL_CIPSOV4_A_MLSLVL) { 175 - if (nla_validate_nested(nla_a, NLBL_CIPSOV4_A_MAX, 176 - netlbl_cipsov4_genl_policy, 177 - NULL) != 0) 173 + if (nla_validate_nested_deprecated(nla_a, 174 + NLBL_CIPSOV4_A_MAX, 175 + netlbl_cipsov4_genl_policy, 176 + NULL) != 0) 178 177 goto add_std_failure; 179 178 nla_for_each_nested(nla_b, nla_a, nla_b_rem) 180 179 switch (nla_type(nla_b)) { ··· 237 234 } 238 235 239 236 if (info->attrs[NLBL_CIPSOV4_A_MLSCATLST]) { 240 - if (nla_validate_nested(info->attrs[NLBL_CIPSOV4_A_MLSCATLST], 241 - NLBL_CIPSOV4_A_MAX, 242 - netlbl_cipsov4_genl_policy, NULL) != 0) 237 + if (nla_validate_nested_deprecated(info->attrs[NLBL_CIPSOV4_A_MLSCATLST], 238 + NLBL_CIPSOV4_A_MAX, 239 + netlbl_cipsov4_genl_policy, 240 + NULL) != 0) 243 241 goto add_std_failure; 244 242 245 243 nla_for_each_nested(nla_a, 246 244 info->attrs[NLBL_CIPSOV4_A_MLSCATLST], 247 245 nla_a_rem) 248 246 if (nla_type(nla_a) == NLBL_CIPSOV4_A_MLSCAT) { 249 - if (nla_validate_nested(nla_a, 250 - NLBL_CIPSOV4_A_MAX, 251 - netlbl_cipsov4_genl_policy, 252 - NULL) != 0) 247 + if (nla_validate_nested_deprecated(nla_a, 248 + NLBL_CIPSOV4_A_MAX, 249 + netlbl_cipsov4_genl_policy, 250 + NULL) != 0) 253 251 goto add_std_failure; 254 252 nla_for_each_nested(nla_b, nla_a, nla_b_rem) 255 253 switch (nla_type(nla_b)) {
+3 -2
net/netlink/genetlink.c
··· 577 577 attrbuf = family->attrbuf; 578 578 579 579 if (attrbuf) { 580 - err = nlmsg_parse(nlh, hdrlen, attrbuf, family->maxattr, 581 - family->policy, extack); 580 + err = nlmsg_parse_deprecated(nlh, hdrlen, attrbuf, 581 + family->maxattr, family->policy, 582 + extack); 582 583 if (err < 0) 583 584 goto out; 584 585 }
+7 -5
net/nfc/netlink.c
··· 119 119 int rc; 120 120 u32 idx; 121 121 122 - rc = nlmsg_parse(cb->nlh, GENL_HDRLEN + nfc_genl_family.hdrsize, 123 - attrbuf, nfc_genl_family.maxattr, nfc_genl_policy, 124 - NULL); 122 + rc = nlmsg_parse_deprecated(cb->nlh, 123 + GENL_HDRLEN + nfc_genl_family.hdrsize, 124 + attrbuf, nfc_genl_family.maxattr, 125 + nfc_genl_policy, NULL); 125 126 if (rc < 0) 126 127 return ERR_PTR(rc); 127 128 ··· 1178 1177 tlvs_len = 0; 1179 1178 1180 1179 nla_for_each_nested(attr, info->attrs[NFC_ATTR_LLC_SDP], rem) { 1181 - rc = nla_parse_nested(sdp_attrs, NFC_SDP_ATTR_MAX, attr, 1182 - nfc_sdp_genl_policy, info->extack); 1180 + rc = nla_parse_nested_deprecated(sdp_attrs, NFC_SDP_ATTR_MAX, 1181 + attr, nfc_sdp_genl_policy, 1182 + info->extack); 1183 1183 1184 1184 if (rc != 0) { 1185 1185 rc = -EINVAL;
+2 -2
net/openvswitch/datapath.c
··· 1375 1375 u32 ufid_flags; 1376 1376 int err; 1377 1377 1378 - err = genlmsg_parse(cb->nlh, &dp_flow_genl_family, a, 1379 - OVS_FLOW_ATTR_MAX, flow_policy, NULL); 1378 + err = genlmsg_parse_deprecated(cb->nlh, &dp_flow_genl_family, a, 1379 + OVS_FLOW_ATTR_MAX, flow_policy, NULL); 1380 1380 if (err) 1381 1381 return err; 1382 1382 ufid_flags = ovs_nla_get_ufid_flags(a[OVS_FLOW_ATTR_UFID_FLAGS]);
+5 -4
net/openvswitch/flow_netlink.c
··· 2854 2854 struct nlattr *a[OVS_USERSPACE_ATTR_MAX + 1]; 2855 2855 int error; 2856 2856 2857 - error = nla_parse_nested(a, OVS_USERSPACE_ATTR_MAX, attr, 2858 - userspace_policy, NULL); 2857 + error = nla_parse_nested_deprecated(a, OVS_USERSPACE_ATTR_MAX, attr, 2858 + userspace_policy, NULL); 2859 2859 if (error) 2860 2860 return error; 2861 2861 ··· 2885 2885 int nested_acts_start; 2886 2886 int start, err; 2887 2887 2888 - err = nla_parse_strict(a, OVS_CHECK_PKT_LEN_ATTR_MAX, nla_data(attr), 2889 - nla_len(attr), cpl_policy, NULL); 2888 + err = nla_parse_deprecated_strict(a, OVS_CHECK_PKT_LEN_ATTR_MAX, 2889 + nla_data(attr), nla_len(attr), 2890 + cpl_policy, NULL); 2890 2891 if (err) 2891 2892 return err; 2892 2893
+3 -3
net/openvswitch/meter.c
··· 227 227 struct nlattr *attr[OVS_BAND_ATTR_MAX + 1]; 228 228 u32 band_max_delta_t; 229 229 230 - err = nla_parse((struct nlattr **)&attr, OVS_BAND_ATTR_MAX, 231 - nla_data(nla), nla_len(nla), band_policy, 232 - NULL); 230 + err = nla_parse_deprecated((struct nlattr **)&attr, 231 + OVS_BAND_ATTR_MAX, nla_data(nla), 232 + nla_len(nla), band_policy, NULL); 233 233 if (err) 234 234 goto exit_free_meter; 235 235
+2 -2
net/openvswitch/vport-vxlan.c
··· 70 70 if (nla_len(attr) < sizeof(struct nlattr)) 71 71 return -EINVAL; 72 72 73 - err = nla_parse_nested(exts, OVS_VXLAN_EXT_MAX, attr, exts_policy, 74 - NULL); 73 + err = nla_parse_nested_deprecated(exts, OVS_VXLAN_EXT_MAX, attr, 74 + exts_policy, NULL); 75 75 if (err < 0) 76 76 return err; 77 77
+4 -4
net/phonet/pn_netlink.c
··· 79 79 80 80 ASSERT_RTNL(); 81 81 82 - err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_phonet_policy, 83 - extack); 82 + err = nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFA_MAX, 83 + ifa_phonet_policy, extack); 84 84 if (err < 0) 85 85 return err; 86 86 ··· 246 246 247 247 ASSERT_RTNL(); 248 248 249 - err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_phonet_policy, 250 - extack); 249 + err = nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, 250 + rtm_phonet_policy, extack); 251 251 if (err < 0) 252 252 return err; 253 253
+2 -1
net/qrtr/qrtr.c
··· 1091 1091 1092 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 1096 if (rc < 0) 1096 1097 return rc; 1097 1098
+14 -12
net/sched/act_api.c
··· 849 849 int err; 850 850 851 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 854 if (err < 0) 854 855 goto err_out; 855 856 err = -EINVAL; ··· 965 964 int err; 966 965 int i; 967 966 968 - err = nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL, extack); 967 + err = nla_parse_nested_deprecated(tb, TCA_ACT_MAX_PRIO, nla, NULL, 968 + extack); 969 969 if (err < 0) 970 970 return err; 971 971 ··· 1101 1099 int index; 1102 1100 int err; 1103 1101 1104 - err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL, extack); 1102 + err = nla_parse_nested_deprecated(tb, TCA_ACT_MAX, nla, NULL, extack); 1105 1103 if (err < 0) 1106 1104 goto err_out; 1107 1105 ··· 1155 1153 1156 1154 b = skb_tail_pointer(skb); 1157 1155 1158 - err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL, extack); 1156 + err = nla_parse_nested_deprecated(tb, TCA_ACT_MAX, nla, NULL, extack); 1159 1157 if (err < 0) 1160 1158 goto err_out; 1161 1159 ··· 1284 1282 size_t attr_size = 0; 1285 1283 struct tc_action *actions[TCA_ACT_MAX_PRIO] = {}; 1286 1284 1287 - ret = nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL, extack); 1285 + ret = nla_parse_nested_deprecated(tb, TCA_ACT_MAX_PRIO, nla, NULL, 1286 + extack); 1288 1287 if (ret < 0) 1289 1288 return ret; 1290 1289 ··· 1387 1384 !netlink_capable(skb, CAP_NET_ADMIN)) 1388 1385 return -EPERM; 1389 1386 1390 - ret = nlmsg_parse(n, sizeof(struct tcamsg), tca, TCA_ROOT_MAX, NULL, 1391 - extack); 1387 + ret = nlmsg_parse_deprecated(n, sizeof(struct tcamsg), tca, 1388 + TCA_ROOT_MAX, NULL, extack); 1392 1389 if (ret < 0) 1393 1390 return ret; 1394 1391 ··· 1439 1436 if (tb1 == NULL) 1440 1437 return NULL; 1441 1438 1442 - if (nla_parse(tb, TCA_ACT_MAX_PRIO, nla_data(tb1), 1443 - NLMSG_ALIGN(nla_len(tb1)), NULL, NULL) < 0) 1439 + if (nla_parse_deprecated(tb, TCA_ACT_MAX_PRIO, nla_data(tb1), NLMSG_ALIGN(nla_len(tb1)), NULL, NULL) < 0) 1444 1440 return NULL; 1445 1441 1446 1442 if (tb[1] == NULL) 1447 1443 return NULL; 1448 - if (nla_parse_nested(tb2, TCA_ACT_MAX, tb[1], NULL, NULL) < 0) 1444 + if (nla_parse_nested_deprecated(tb2, TCA_ACT_MAX, tb[1], NULL, NULL) < 0) 1449 1445 return NULL; 1450 1446 kind = tb2[TCA_ACT_KIND]; 1451 1447 ··· 1468 1466 u32 msecs_since = 0; 1469 1467 u32 act_count = 0; 1470 1468 1471 - ret = nlmsg_parse(cb->nlh, sizeof(struct tcamsg), tb, TCA_ROOT_MAX, 1472 - tcaa_policy, cb->extack); 1469 + ret = nlmsg_parse_deprecated(cb->nlh, sizeof(struct tcamsg), tb, 1470 + TCA_ROOT_MAX, tcaa_policy, cb->extack); 1473 1471 if (ret < 0) 1474 1472 return ret; 1475 1473
+2 -1
net/sched/act_bpf.c
··· 293 293 if (!nla) 294 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 298 if (ret < 0) 298 299 return ret; 299 300
+2 -2
net/sched/act_connmark.c
··· 111 111 if (!nla) 112 112 return -EINVAL; 113 113 114 - ret = nla_parse_nested(tb, TCA_CONNMARK_MAX, nla, connmark_policy, 115 - NULL); 114 + ret = nla_parse_nested_deprecated(tb, TCA_CONNMARK_MAX, nla, 115 + connmark_policy, NULL); 116 116 if (ret < 0) 117 117 return ret; 118 118
+2 -1
net/sched/act_csum.c
··· 61 61 if (nla == NULL) 62 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 66 if (err < 0) 66 67 return err; 67 68
+2 -1
net/sched/act_gact.c
··· 74 74 if (nla == NULL) 75 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 79 if (err < 0) 79 80 return err; 80 81
+5 -3
net/sched/act_ife.c
··· 486 486 int ret = 0; 487 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 491 if (err < 0) 491 492 return err; 492 493 ··· 568 567 INIT_LIST_HEAD(&ife->metalist); 569 568 570 569 if (tb[TCA_IFE_METALST]) { 571 - err = nla_parse_nested(tb2, IFE_META_MAX, tb[TCA_IFE_METALST], 572 - NULL, NULL); 570 + err = nla_parse_nested_deprecated(tb2, IFE_META_MAX, 571 + tb[TCA_IFE_METALST], NULL, 572 + NULL); 573 573 if (err) 574 574 goto metadata_parse_err; 575 575 err = populate_metalist(ife, tb2, exists, rtnl_held);
+2 -1
net/sched/act_ipt.c
··· 113 113 if (nla == NULL) 114 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 118 if (err < 0) 118 119 return err; 119 120
+2 -1
net/sched/act_mirred.c
··· 111 111 NL_SET_ERR_MSG_MOD(extack, "Mirred requires attributes to be passed"); 112 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 116 if (ret < 0) 116 117 return ret; 117 118 if (!tb[TCA_MIRRED_PARMS]) {
+2 -1
net/sched/act_nat.c
··· 52 52 if (nla == NULL) 53 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 57 if (err < 0) 57 58 return err; 58 59
+5 -3
net/sched/act_pedit.c
··· 70 70 goto err_out; 71 71 } 72 72 73 - err = nla_parse_nested(tb, TCA_PEDIT_KEY_EX_MAX, ka, 74 - pedit_key_ex_policy, NULL); 73 + err = nla_parse_nested_deprecated(tb, TCA_PEDIT_KEY_EX_MAX, 74 + ka, pedit_key_ex_policy, 75 + NULL); 75 76 if (err) 76 77 goto err_out; 77 78 ··· 159 158 return -EINVAL; 160 159 } 161 160 162 - err = nla_parse_nested(tb, TCA_PEDIT_MAX, nla, pedit_policy, NULL); 161 + err = nla_parse_nested_deprecated(tb, TCA_PEDIT_MAX, nla, 162 + pedit_policy, NULL); 163 163 if (err < 0) 164 164 return err; 165 165
+2 -1
net/sched/act_police.c
··· 100 100 if (nla == NULL) 101 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 105 if (err < 0) 105 106 return err; 106 107
+2 -1
net/sched/act_sample.c
··· 53 53 54 54 if (!nla) 55 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 58 if (ret < 0) 58 59 return ret; 59 60 if (!tb[TCA_SAMPLE_PARMS] || !tb[TCA_SAMPLE_RATE] ||
+2 -1
net/sched/act_simple.c
··· 104 104 if (nla == NULL) 105 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 109 if (err < 0) 109 110 return err; 110 111
+2 -1
net/sched/act_skbedit.c
··· 114 114 if (nla == NULL) 115 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 119 if (err < 0) 119 120 return err; 120 121
+2 -1
net/sched/act_skbmod.c
··· 102 102 if (!nla) 103 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 107 if (err < 0) 107 108 return err; 108 109
+7 -6
net/sched/act_tunnel_key.c
··· 76 76 int err, data_len, opt_len; 77 77 u8 *data; 78 78 79 - err = nla_parse_nested(tb, TCA_TUNNEL_KEY_ENC_OPT_GENEVE_MAX, 80 - nla, geneve_opt_policy, extack); 79 + err = nla_parse_nested_deprecated(tb, 80 + TCA_TUNNEL_KEY_ENC_OPT_GENEVE_MAX, 81 + nla, geneve_opt_policy, extack); 81 82 if (err < 0) 82 83 return err; 83 84 ··· 126 125 int err, rem, opt_len, len = nla_len(nla), opts_len = 0; 127 126 const struct nlattr *attr, *head = nla_data(nla); 128 127 129 - err = nla_validate(head, len, TCA_TUNNEL_KEY_ENC_OPTS_MAX, 130 - enc_opts_policy, extack); 128 + err = nla_validate_deprecated(head, len, TCA_TUNNEL_KEY_ENC_OPTS_MAX, 129 + enc_opts_policy, extack); 131 130 if (err) 132 131 return err; 133 132 ··· 236 235 return -EINVAL; 237 236 } 238 237 239 - err = nla_parse_nested(tb, TCA_TUNNEL_KEY_MAX, nla, tunnel_key_policy, 240 - extack); 238 + err = nla_parse_nested_deprecated(tb, TCA_TUNNEL_KEY_MAX, nla, 239 + tunnel_key_policy, extack); 241 240 if (err < 0) { 242 241 NL_SET_ERR_MSG(extack, "Failed to parse nested tunnel key attributes"); 243 242 return err;
+2 -1
net/sched/act_vlan.c
··· 124 124 if (!nla) 125 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 129 if (err < 0) 129 130 return err; 130 131
+12 -8
net/sched/cls_api.c
··· 2006 2006 replay: 2007 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 2011 if (err < 0) 2011 2012 return err; 2012 2013 ··· 2218 2217 if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) 2219 2218 return -EPERM; 2220 2219 2221 - err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, rtm_tca_policy, extack); 2220 + err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX, 2221 + rtm_tca_policy, extack); 2222 2222 if (err < 0) 2223 2223 return err; 2224 2224 ··· 2368 2366 int err; 2369 2367 bool rtnl_held = false; 2370 2368 2371 - err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, rtm_tca_policy, extack); 2369 + err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX, 2370 + rtm_tca_policy, extack); 2372 2371 if (err < 0) 2373 2372 return err; 2374 2373 ··· 2561 2558 if (nlmsg_len(cb->nlh) < sizeof(*tcm)) 2562 2559 return skb->len; 2563 2560 2564 - err = nlmsg_parse(cb->nlh, sizeof(*tcm), tca, TCA_MAX, NULL, 2565 - cb->extack); 2561 + err = nlmsg_parse_deprecated(cb->nlh, sizeof(*tcm), tca, TCA_MAX, 2562 + NULL, cb->extack); 2566 2563 if (err) 2567 2564 return err; 2568 2565 ··· 2809 2806 return -EPERM; 2810 2807 2811 2808 replay: 2812 - err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, rtm_tca_policy, extack); 2809 + err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX, 2810 + rtm_tca_policy, extack); 2813 2811 if (err < 0) 2814 2812 return err; 2815 2813 ··· 2941 2937 if (nlmsg_len(cb->nlh) < sizeof(*tcm)) 2942 2938 return skb->len; 2943 2939 2944 - err = nlmsg_parse(cb->nlh, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, 2945 - cb->extack); 2940 + err = nlmsg_parse_deprecated(cb->nlh, sizeof(*tcm), tca, TCA_MAX, 2941 + rtm_tca_policy, cb->extack); 2946 2942 if (err) 2947 2943 return err; 2948 2944
+2 -2
net/sched/cls_basic.c
··· 185 185 if (tca[TCA_OPTIONS] == NULL) 186 186 return -EINVAL; 187 187 188 - err = nla_parse_nested(tb, TCA_BASIC_MAX, tca[TCA_OPTIONS], 189 - basic_policy, NULL); 188 + err = nla_parse_nested_deprecated(tb, TCA_BASIC_MAX, tca[TCA_OPTIONS], 189 + basic_policy, NULL); 190 190 if (err < 0) 191 191 return err; 192 192
+2 -2
net/sched/cls_bpf.c
··· 468 468 if (tca[TCA_OPTIONS] == NULL) 469 469 return -EINVAL; 470 470 471 - ret = nla_parse_nested(tb, TCA_BPF_MAX, tca[TCA_OPTIONS], bpf_policy, 472 - NULL); 471 + ret = nla_parse_nested_deprecated(tb, TCA_BPF_MAX, tca[TCA_OPTIONS], 472 + bpf_policy, NULL); 473 473 if (ret < 0) 474 474 return ret; 475 475
+3 -2
net/sched/cls_cgroup.c
··· 104 104 goto errout; 105 105 new->handle = handle; 106 106 new->tp = tp; 107 - err = nla_parse_nested(tb, TCA_CGROUP_MAX, tca[TCA_OPTIONS], 108 - cgroup_policy, NULL); 107 + err = nla_parse_nested_deprecated(tb, TCA_CGROUP_MAX, 108 + tca[TCA_OPTIONS], cgroup_policy, 109 + NULL); 109 110 if (err < 0) 110 111 goto errout; 111 112
+2 -1
net/sched/cls_flow.c
··· 408 408 if (opt == NULL) 409 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 413 if (err < 0) 413 414 return err; 414 415
+13 -12
net/sched/cls_flower.c
··· 884 884 return -EINVAL; 885 885 } 886 886 887 - err = nla_parse_nested(tb, TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX, 888 - nla, geneve_opt_policy, extack); 887 + err = nla_parse_nested_deprecated(tb, 888 + TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX, 889 + nla, geneve_opt_policy, extack); 889 890 if (err < 0) 890 891 return err; 891 892 ··· 948 947 const struct nlattr *nla_enc_key, *nla_opt_key, *nla_opt_msk = NULL; 949 948 int err, option_len, key_depth, msk_depth = 0; 950 949 951 - err = nla_validate_nested(tb[TCA_FLOWER_KEY_ENC_OPTS], 952 - TCA_FLOWER_KEY_ENC_OPTS_MAX, 953 - enc_opts_policy, extack); 950 + err = nla_validate_nested_deprecated(tb[TCA_FLOWER_KEY_ENC_OPTS], 951 + TCA_FLOWER_KEY_ENC_OPTS_MAX, 952 + enc_opts_policy, extack); 954 953 if (err) 955 954 return err; 956 955 957 956 nla_enc_key = nla_data(tb[TCA_FLOWER_KEY_ENC_OPTS]); 958 957 959 958 if (tb[TCA_FLOWER_KEY_ENC_OPTS_MASK]) { 960 - err = nla_validate_nested(tb[TCA_FLOWER_KEY_ENC_OPTS_MASK], 961 - TCA_FLOWER_KEY_ENC_OPTS_MAX, 962 - enc_opts_policy, extack); 959 + err = nla_validate_nested_deprecated(tb[TCA_FLOWER_KEY_ENC_OPTS_MASK], 960 + TCA_FLOWER_KEY_ENC_OPTS_MAX, 961 + enc_opts_policy, extack); 963 962 if (err) 964 963 return err; 965 964 ··· 1514 1513 goto errout_mask_alloc; 1515 1514 } 1516 1515 1517 - err = nla_parse_nested(tb, TCA_FLOWER_MAX, tca[TCA_OPTIONS], 1518 - fl_policy, NULL); 1516 + err = nla_parse_nested_deprecated(tb, TCA_FLOWER_MAX, 1517 + tca[TCA_OPTIONS], fl_policy, NULL); 1519 1518 if (err < 0) 1520 1519 goto errout_tb; 1521 1520 ··· 1853 1852 tb = kcalloc(TCA_FLOWER_MAX + 1, sizeof(struct nlattr *), GFP_KERNEL); 1854 1853 if (!tb) 1855 1854 return ERR_PTR(-ENOBUFS); 1856 - err = nla_parse_nested(tb, TCA_FLOWER_MAX, tca[TCA_OPTIONS], 1857 - fl_policy, NULL); 1855 + err = nla_parse_nested_deprecated(tb, TCA_FLOWER_MAX, 1856 + tca[TCA_OPTIONS], fl_policy, NULL); 1858 1857 if (err) 1859 1858 goto errout_tb; 1860 1859
+2 -1
net/sched/cls_fw.c
··· 263 263 if (!opt) 264 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 268 if (err < 0) 268 269 return err; 269 270
+2 -2
net/sched/cls_matchall.c
··· 181 181 if (head) 182 182 return -EEXIST; 183 183 184 - err = nla_parse_nested(tb, TCA_MATCHALL_MAX, tca[TCA_OPTIONS], 185 - mall_policy, NULL); 184 + err = nla_parse_nested_deprecated(tb, TCA_MATCHALL_MAX, 185 + tca[TCA_OPTIONS], mall_policy, NULL); 186 186 if (err < 0) 187 187 return err; 188 188
+2 -1
net/sched/cls_route.c
··· 484 484 if (opt == NULL) 485 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 489 if (err < 0) 489 490 return err; 490 491
+2 -1
net/sched/cls_rsvp.h
··· 497 497 if (opt == NULL) 498 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 502 if (err < 0) 502 503 return err; 503 504
+2 -1
net/sched/cls_tcindex.c
··· 510 510 if (!opt) 511 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 515 if (err < 0) 515 516 return err; 516 517
+2 -1
net/sched/cls_u32.c
··· 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 889 if (err < 0) 889 890 return err; 890 891
+2 -2
net/sched/em_ipt.c
··· 120 120 struct xt_match *match; 121 121 int mdata_len, ret; 122 122 123 - ret = nla_parse(tb, TCA_EM_IPT_MAX, data, data_len, em_ipt_policy, 124 - NULL); 123 + ret = nla_parse_deprecated(tb, TCA_EM_IPT_MAX, data, data_len, 124 + em_ipt_policy, NULL); 125 125 if (ret < 0) 126 126 return ret; 127 127
+2 -1
net/sched/em_meta.c
··· 912 912 struct tcf_meta_hdr *hdr; 913 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 917 if (err < 0) 917 918 goto errout; 918 919
+2 -1
net/sched/ematch.c
··· 314 314 if (!nla) 315 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 319 if (err < 0) 319 320 goto errout; 320 321
+10 -9
net/sched/sch_api.c
··· 479 479 u16 *tab = NULL; 480 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 484 if (err < 0) 484 485 return ERR_PTR(err); 485 486 if (!tb[TCA_STAB_BASE]) { ··· 1424 1423 !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) 1425 1424 return -EPERM; 1426 1425 1427 - err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, 1428 - extack); 1426 + err = nlmsg_parse_deprecated(n, sizeof(*tcm), tca, TCA_MAX, 1427 + rtm_tca_policy, extack); 1429 1428 if (err < 0) 1430 1429 return err; 1431 1430 ··· 1509 1508 1510 1509 replay: 1511 1510 /* Reinit, just in case something touches this. */ 1512 - err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, 1513 - extack); 1511 + err = nlmsg_parse_deprecated(n, sizeof(*tcm), tca, TCA_MAX, 1512 + rtm_tca_policy, extack); 1514 1513 if (err < 0) 1515 1514 return err; 1516 1515 ··· 1744 1743 idx = 0; 1745 1744 ASSERT_RTNL(); 1746 1745 1747 - err = nlmsg_parse(nlh, sizeof(struct tcmsg), tca, TCA_MAX, 1748 - rtm_tca_policy, cb->extack); 1746 + err = nlmsg_parse_deprecated(nlh, sizeof(struct tcmsg), tca, TCA_MAX, 1747 + rtm_tca_policy, cb->extack); 1749 1748 if (err < 0) 1750 1749 return err; 1751 1750 ··· 1973 1972 !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) 1974 1973 return -EPERM; 1975 1974 1976 - err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, 1977 - extack); 1975 + err = nlmsg_parse_deprecated(n, sizeof(*tcm), tca, TCA_MAX, 1976 + rtm_tca_policy, extack); 1978 1977 if (err < 0) 1979 1978 return err; 1980 1979
+2 -1
net/sched/sch_atm.c
··· 223 223 if (opt == NULL) 224 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 228 if (error < 0) 228 229 return error; 229 230
+2 -1
net/sched/sch_cake.c
··· 2531 2531 if (!opt) 2532 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 2536 if (err < 0) 2536 2537 return err; 2537 2538
+4 -2
net/sched/sch_cbq.c
··· 1149 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 1154 if (err < 0) 1154 1155 return err; 1155 1156 ··· 1474 1473 return -EINVAL; 1475 1474 } 1476 1475 1477 - err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy, extack); 1476 + err = nla_parse_nested_deprecated(tb, TCA_CBQ_MAX, opt, cbq_policy, 1477 + extack); 1478 1478 if (err < 0) 1479 1479 return err; 1480 1480
+2 -1
net/sched/sch_cbs.c
··· 358 358 struct tc_cbs_qopt *qopt; 359 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 363 if (err < 0) 363 364 return err; 364 365
+2 -1
net/sched/sch_choke.c
··· 358 358 if (opt == NULL) 359 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 363 if (err < 0) 363 364 return err; 364 365
+2 -1
net/sched/sch_codel.c
··· 141 141 if (!opt) 142 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 146 if (err < 0) 146 147 return err; 147 148
+2 -1
net/sched/sch_drr.c
··· 70 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 75 if (err < 0) 75 76 return err; 76 77
+4 -2
net/sched/sch_dsmark.c
··· 132 132 if (!opt) 133 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 137 if (err < 0) 137 138 goto errout; 138 139 ··· 354 353 if (err) 355 354 return err; 356 355 357 - err = nla_parse_nested(tb, TCA_DSMARK_MAX, opt, dsmark_policy, NULL); 356 + err = nla_parse_nested_deprecated(tb, TCA_DSMARK_MAX, opt, 357 + dsmark_policy, NULL); 358 358 if (err < 0) 359 359 goto errout; 360 360
+2 -1
net/sched/sch_etf.c
··· 351 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 356 if (err < 0) 356 357 return err; 357 358
+2 -1
net/sched/sch_fq.c
··· 684 684 if (!opt) 685 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 689 if (err < 0) 689 690 return err; 690 691
+2 -2
net/sched/sch_fq_codel.c
··· 387 387 if (!opt) 388 388 return -EINVAL; 389 389 390 - err = nla_parse_nested(tb, TCA_FQ_CODEL_MAX, opt, fq_codel_policy, 391 - NULL); 390 + err = nla_parse_nested_deprecated(tb, TCA_FQ_CODEL_MAX, opt, 391 + fq_codel_policy, NULL); 392 392 if (err < 0) 393 393 return err; 394 394 if (tb[TCA_FQ_CODEL_FLOWS]) {
+10 -7
net/sched/sch_gred.c
··· 538 538 struct nlattr *tb[TCA_GRED_VQ_MAX + 1]; 539 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 544 dp = nla_get_u32(tb[TCA_GRED_VQ_DP]); 544 545 ··· 569 568 int err; 570 569 u32 dp; 571 570 572 - err = nla_parse_nested(tb, TCA_GRED_VQ_MAX, entry, gred_vq_policy, 573 - extack); 571 + err = nla_parse_nested_deprecated(tb, TCA_GRED_VQ_MAX, entry, 572 + gred_vq_policy, extack); 574 573 if (err < 0) 575 574 return err; 576 575 ··· 611 610 const struct nlattr *attr; 612 611 int rem, err; 613 612 614 - err = nla_validate_nested(vqs, TCA_GRED_VQ_ENTRY_MAX, 615 - gred_vqe_policy, extack); 613 + err = nla_validate_nested_deprecated(vqs, TCA_GRED_VQ_ENTRY_MAX, 614 + gred_vqe_policy, extack); 616 615 if (err < 0) 617 616 return err; 618 617 ··· 651 650 if (opt == NULL) 652 651 return -EINVAL; 653 652 654 - err = nla_parse_nested(tb, TCA_GRED_MAX, opt, gred_policy, extack); 653 + err = nla_parse_nested_deprecated(tb, TCA_GRED_MAX, opt, gred_policy, 654 + extack); 655 655 if (err < 0) 656 656 return err; 657 657 ··· 739 737 if (!opt) 740 738 return -EINVAL; 741 739 742 - err = nla_parse_nested(tb, TCA_GRED_MAX, opt, gred_policy, extack); 740 + err = nla_parse_nested_deprecated(tb, TCA_GRED_MAX, opt, gred_policy, 741 + extack); 743 742 if (err < 0) 744 743 return err; 745 744
+2 -1
net/sched/sch_hfsc.c
··· 926 926 if (opt == NULL) 927 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 931 if (err < 0) 931 932 return err; 932 933
+2 -1
net/sched/sch_hhf.c
··· 518 518 if (!opt) 519 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 523 if (err < 0) 523 524 return err; 524 525
+4 -2
net/sched/sch_htb.c
··· 1012 1012 if (err) 1013 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 1017 if (err < 0) 1017 1018 return err; 1018 1019 ··· 1311 1310 if (!opt) 1312 1311 goto failure; 1313 1312 1314 - err = nla_parse_nested(tb, TCA_HTB_MAX, opt, htb_policy, NULL); 1313 + err = nla_parse_nested_deprecated(tb, TCA_HTB_MAX, opt, htb_policy, 1314 + NULL); 1315 1315 if (err < 0) 1316 1316 goto failure; 1317 1317
+3 -2
net/sched/sch_mqprio.c
··· 125 125 int nested_len = nla_len(nla) - NLA_ALIGN(len); 126 126 127 127 if (nested_len >= nla_attr_size(0)) 128 - return nla_parse(tb, maxtype, nla_data(nla) + NLA_ALIGN(len), 129 - nested_len, policy, NULL); 128 + return nla_parse_deprecated(tb, maxtype, 129 + nla_data(nla) + NLA_ALIGN(len), 130 + nested_len, policy, NULL); 130 131 131 132 memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); 132 133 return 0;
+3 -2
net/sched/sch_netem.c
··· 935 935 } 936 936 937 937 if (nested_len >= nla_attr_size(0)) 938 - return nla_parse(tb, maxtype, nla_data(nla) + NLA_ALIGN(len), 939 - nested_len, policy, NULL); 938 + return nla_parse_deprecated(tb, maxtype, 939 + nla_data(nla) + NLA_ALIGN(len), 940 + nested_len, policy, NULL); 940 941 941 942 memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); 942 943 return 0;
+2 -1
net/sched/sch_pie.c
··· 216 216 if (!opt) 217 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 221 if (err < 0) 221 222 return err; 222 223
+2 -2
net/sched/sch_qfq.c
··· 410 410 return -EINVAL; 411 411 } 412 412 413 - err = nla_parse_nested(tb, TCA_QFQ_MAX, tca[TCA_OPTIONS], qfq_policy, 414 - NULL); 413 + err = nla_parse_nested_deprecated(tb, TCA_QFQ_MAX, tca[TCA_OPTIONS], 414 + qfq_policy, NULL); 415 415 if (err < 0) 416 416 return err; 417 417
+2 -1
net/sched/sch_red.c
··· 205 205 if (opt == NULL) 206 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 210 if (err < 0) 210 211 return err; 211 212
+2 -1
net/sched/sch_sfb.c
··· 499 499 int err; 500 500 501 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 504 if (err < 0) 504 505 return -EINVAL; 505 506
+10 -9
net/sched/sch_taprio.c
··· 310 310 struct nlattr *tb[TCA_TAPRIO_SCHED_ENTRY_MAX + 1] = { }; 311 311 int err; 312 312 313 - err = nla_parse_nested(tb, TCA_TAPRIO_SCHED_ENTRY_MAX, n, 314 - entry_policy, NULL); 313 + err = nla_parse_nested_deprecated(tb, TCA_TAPRIO_SCHED_ENTRY_MAX, n, 314 + entry_policy, NULL); 315 315 if (err < 0) { 316 316 NL_SET_ERR_MSG(extack, "Could not parse nested entry"); 317 317 return -EINVAL; ··· 334 334 u32 index; 335 335 int err; 336 336 337 - err = nla_parse_nested(tb_list, TCA_TAPRIO_SCHED_MAX, 338 - n, entry_list_policy, NULL); 337 + err = nla_parse_nested_deprecated(tb_list, TCA_TAPRIO_SCHED_MAX, n, 338 + entry_list_policy, NULL); 339 339 if (err < 0) { 340 340 NL_SET_ERR_MSG(extack, "Could not parse nested entry"); 341 341 return -EINVAL; ··· 346 346 return -EINVAL; 347 347 } 348 348 349 - err = nla_parse_nested(tb_entry, TCA_TAPRIO_SCHED_ENTRY_MAX, 350 - tb_list[TCA_TAPRIO_SCHED_ENTRY], 351 - entry_policy, NULL); 349 + err = nla_parse_nested_deprecated(tb_entry, 350 + TCA_TAPRIO_SCHED_ENTRY_MAX, 351 + tb_list[TCA_TAPRIO_SCHED_ENTRY], 352 + entry_policy, NULL); 352 353 if (err < 0) { 353 354 NL_SET_ERR_MSG(extack, "Could not parse nested entry"); 354 355 return -EINVAL; ··· 645 644 int i, err, size; 646 645 ktime_t start; 647 646 648 - err = nla_parse_nested(tb, TCA_TAPRIO_ATTR_MAX, opt, 649 - taprio_policy, extack); 647 + err = nla_parse_nested_deprecated(tb, TCA_TAPRIO_ATTR_MAX, opt, 648 + taprio_policy, extack); 650 649 if (err < 0) 651 650 return err; 652 651
+2 -1
net/sched/sch_tbf.c
··· 308 308 s64 buffer, mtu; 309 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 313 if (err < 0) 313 314 return err; 314 315
+21 -21
net/tipc/bearer.c
··· 776 776 if (!info->attrs[TIPC_NLA_BEARER]) 777 777 return -EINVAL; 778 778 779 - err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX, 780 - info->attrs[TIPC_NLA_BEARER], 781 - tipc_nl_bearer_policy, info->extack); 779 + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX, 780 + info->attrs[TIPC_NLA_BEARER], 781 + tipc_nl_bearer_policy, info->extack); 782 782 if (err) 783 783 return err; 784 784 ··· 825 825 if (!info->attrs[TIPC_NLA_BEARER]) 826 826 return -EINVAL; 827 827 828 - err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX, 829 - info->attrs[TIPC_NLA_BEARER], 830 - tipc_nl_bearer_policy, info->extack); 828 + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX, 829 + info->attrs[TIPC_NLA_BEARER], 830 + tipc_nl_bearer_policy, info->extack); 831 831 if (err) 832 832 return err; 833 833 ··· 870 870 if (!info->attrs[TIPC_NLA_BEARER]) 871 871 return -EINVAL; 872 872 873 - err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX, 874 - info->attrs[TIPC_NLA_BEARER], 875 - tipc_nl_bearer_policy, info->extack); 873 + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX, 874 + info->attrs[TIPC_NLA_BEARER], 875 + tipc_nl_bearer_policy, info->extack); 876 876 if (err) 877 877 return err; 878 878 ··· 921 921 if (!info->attrs[TIPC_NLA_BEARER]) 922 922 return -EINVAL; 923 923 924 - err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX, 925 - info->attrs[TIPC_NLA_BEARER], 926 - tipc_nl_bearer_policy, info->extack); 924 + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX, 925 + info->attrs[TIPC_NLA_BEARER], 926 + tipc_nl_bearer_policy, info->extack); 927 927 if (err) 928 928 return err; 929 929 ··· 964 964 if (!info->attrs[TIPC_NLA_BEARER]) 965 965 return -EINVAL; 966 966 967 - err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX, 968 - info->attrs[TIPC_NLA_BEARER], 969 - tipc_nl_bearer_policy, info->extack); 967 + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX, 968 + info->attrs[TIPC_NLA_BEARER], 969 + tipc_nl_bearer_policy, info->extack); 970 970 if (err) 971 971 return err; 972 972 ··· 1107 1107 if (!info->attrs[TIPC_NLA_MEDIA]) 1108 1108 return -EINVAL; 1109 1109 1110 - err = nla_parse_nested(attrs, TIPC_NLA_MEDIA_MAX, 1111 - info->attrs[TIPC_NLA_MEDIA], 1112 - tipc_nl_media_policy, info->extack); 1110 + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_MEDIA_MAX, 1111 + info->attrs[TIPC_NLA_MEDIA], 1112 + tipc_nl_media_policy, info->extack); 1113 1113 if (err) 1114 1114 return err; 1115 1115 ··· 1155 1155 if (!info->attrs[TIPC_NLA_MEDIA]) 1156 1156 return -EINVAL; 1157 1157 1158 - err = nla_parse_nested(attrs, TIPC_NLA_MEDIA_MAX, 1159 - info->attrs[TIPC_NLA_MEDIA], 1160 - tipc_nl_media_policy, info->extack); 1158 + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_MEDIA_MAX, 1159 + info->attrs[TIPC_NLA_MEDIA], 1160 + tipc_nl_media_policy, info->extack); 1161 1161 1162 1162 if (!attrs[TIPC_NLA_MEDIA_NAME]) 1163 1163 return -EINVAL;
+2 -2
net/tipc/link.c
··· 2148 2148 { 2149 2149 int err; 2150 2150 2151 - err = nla_parse_nested(props, TIPC_NLA_PROP_MAX, prop, 2152 - tipc_nl_prop_policy, NULL); 2151 + err = nla_parse_nested_deprecated(props, TIPC_NLA_PROP_MAX, prop, 2152 + tipc_nl_prop_policy, NULL); 2153 2153 if (err) 2154 2154 return err; 2155 2155
+3 -3
net/tipc/net.c
··· 245 245 if (!info->attrs[TIPC_NLA_NET]) 246 246 return -EINVAL; 247 247 248 - err = nla_parse_nested(attrs, TIPC_NLA_NET_MAX, 249 - info->attrs[TIPC_NLA_NET], tipc_nl_net_policy, 250 - info->extack); 248 + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_NET_MAX, 249 + info->attrs[TIPC_NLA_NET], 250 + tipc_nl_net_policy, info->extack); 251 251 252 252 if (err) 253 253 return err;
+2 -2
net/tipc/netlink.c
··· 255 255 if (!*attr) 256 256 return -EOPNOTSUPP; 257 257 258 - return nlmsg_parse(nlh, GENL_HDRLEN, *attr, maxattr, tipc_nl_policy, 259 - NULL); 258 + return nlmsg_parse_deprecated(nlh, GENL_HDRLEN, *attr, maxattr, 259 + tipc_nl_policy, NULL); 260 260 } 261 261 262 262 int __init tipc_netlink_start(void)
+20 -18
net/tipc/node.c
··· 1885 1885 if (!info->attrs[TIPC_NLA_NET]) 1886 1886 return -EINVAL; 1887 1887 1888 - err = nla_parse_nested(attrs, TIPC_NLA_NET_MAX, 1889 - info->attrs[TIPC_NLA_NET], tipc_nl_net_policy, 1890 - info->extack); 1888 + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_NET_MAX, 1889 + info->attrs[TIPC_NLA_NET], 1890 + tipc_nl_net_policy, info->extack); 1891 1891 if (err) 1892 1892 return err; 1893 1893 ··· 2043 2043 if (!info->attrs[TIPC_NLA_LINK]) 2044 2044 return -EINVAL; 2045 2045 2046 - err = nla_parse_nested(attrs, TIPC_NLA_LINK_MAX, 2047 - info->attrs[TIPC_NLA_LINK], 2048 - tipc_nl_link_policy, info->extack); 2046 + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_LINK_MAX, 2047 + info->attrs[TIPC_NLA_LINK], 2048 + tipc_nl_link_policy, info->extack); 2049 2049 if (err) 2050 2050 return err; 2051 2051 ··· 2119 2119 if (!info->attrs[TIPC_NLA_LINK]) 2120 2120 return -EINVAL; 2121 2121 2122 - err = nla_parse_nested(attrs, TIPC_NLA_LINK_MAX, 2123 - info->attrs[TIPC_NLA_LINK], 2124 - tipc_nl_link_policy, info->extack); 2122 + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_LINK_MAX, 2123 + info->attrs[TIPC_NLA_LINK], 2124 + tipc_nl_link_policy, info->extack); 2125 2125 if (err) 2126 2126 return err; 2127 2127 ··· 2184 2184 if (!info->attrs[TIPC_NLA_LINK]) 2185 2185 return -EINVAL; 2186 2186 2187 - err = nla_parse_nested(attrs, TIPC_NLA_LINK_MAX, 2188 - info->attrs[TIPC_NLA_LINK], 2189 - tipc_nl_link_policy, info->extack); 2187 + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_LINK_MAX, 2188 + info->attrs[TIPC_NLA_LINK], 2189 + tipc_nl_link_policy, info->extack); 2190 2190 if (err) 2191 2191 return err; 2192 2192 ··· 2324 2324 if (!info->attrs[TIPC_NLA_MON]) 2325 2325 return -EINVAL; 2326 2326 2327 - err = nla_parse_nested(attrs, TIPC_NLA_MON_MAX, 2328 - info->attrs[TIPC_NLA_MON], 2329 - tipc_nl_monitor_policy, info->extack); 2327 + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_MON_MAX, 2328 + info->attrs[TIPC_NLA_MON], 2329 + tipc_nl_monitor_policy, 2330 + info->extack); 2330 2331 if (err) 2331 2332 return err; 2332 2333 ··· 2445 2444 if (!attrs[TIPC_NLA_MON]) 2446 2445 return -EINVAL; 2447 2446 2448 - err = nla_parse_nested(mon, TIPC_NLA_MON_MAX, 2449 - attrs[TIPC_NLA_MON], 2450 - tipc_nl_monitor_policy, NULL); 2447 + err = nla_parse_nested_deprecated(mon, TIPC_NLA_MON_MAX, 2448 + attrs[TIPC_NLA_MON], 2449 + tipc_nl_monitor_policy, 2450 + NULL); 2451 2451 if (err) 2452 2452 return err; 2453 2453
+3 -3
net/tipc/socket.c
··· 3599 3599 if (!attrs[TIPC_NLA_SOCK]) 3600 3600 return -EINVAL; 3601 3601 3602 - err = nla_parse_nested(sock, TIPC_NLA_SOCK_MAX, 3603 - attrs[TIPC_NLA_SOCK], 3604 - tipc_nl_sock_policy, NULL); 3602 + err = nla_parse_nested_deprecated(sock, TIPC_NLA_SOCK_MAX, 3603 + attrs[TIPC_NLA_SOCK], 3604 + tipc_nl_sock_policy, NULL); 3605 3605 if (err) 3606 3606 return err; 3607 3607
+5 -8
net/tipc/udp_media.c
··· 447 447 if (!attrs[TIPC_NLA_BEARER]) 448 448 return -EINVAL; 449 449 450 - err = nla_parse_nested(battrs, TIPC_NLA_BEARER_MAX, 451 - attrs[TIPC_NLA_BEARER], 452 - tipc_nl_bearer_policy, NULL); 450 + err = nla_parse_nested_deprecated(battrs, TIPC_NLA_BEARER_MAX, 451 + attrs[TIPC_NLA_BEARER], 452 + tipc_nl_bearer_policy, NULL); 453 453 if (err) 454 454 return err; 455 455 ··· 601 601 struct nlattr *opts[TIPC_NLA_UDP_MAX + 1]; 602 602 struct udp_media_addr *dst; 603 603 604 - if (nla_parse_nested(opts, TIPC_NLA_UDP_MAX, attr, 605 - tipc_nl_udp_policy, NULL)) 604 + if (nla_parse_nested_deprecated(opts, TIPC_NLA_UDP_MAX, attr, tipc_nl_udp_policy, NULL)) 606 605 return -EINVAL; 607 606 608 607 if (!opts[TIPC_NLA_UDP_REMOTE]) ··· 654 655 if (!attrs[TIPC_NLA_BEARER_UDP_OPTS]) 655 656 goto err; 656 657 657 - if (nla_parse_nested(opts, TIPC_NLA_UDP_MAX, 658 - attrs[TIPC_NLA_BEARER_UDP_OPTS], 659 - tipc_nl_udp_policy, NULL)) 658 + if (nla_parse_nested_deprecated(opts, TIPC_NLA_UDP_MAX, attrs[TIPC_NLA_BEARER_UDP_OPTS], tipc_nl_udp_policy, NULL)) 660 659 goto err; 661 660 662 661 if (!opts[TIPC_NLA_UDP_LOCAL] || !opts[TIPC_NLA_UDP_REMOTE]) {
+106 -85
net/wireless/nl80211.c
··· 703 703 int err; 704 704 705 705 if (!cb->args[0]) { 706 - err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize, 707 - genl_family_attrbuf(&nl80211_fam), 708 - nl80211_fam.maxattr, nl80211_policy, NULL); 706 + err = nlmsg_parse_deprecated(cb->nlh, 707 + GENL_HDRLEN + nl80211_fam.hdrsize, 708 + genl_family_attrbuf(&nl80211_fam), 709 + nl80211_fam.maxattr, 710 + nl80211_policy, NULL); 709 711 if (err) 710 712 return err; 711 713 ··· 927 925 struct key_parse *k) 928 926 { 929 927 struct nlattr *tb[NL80211_KEY_MAX + 1]; 930 - int err = nla_parse_nested(tb, NL80211_KEY_MAX, key, 931 - nl80211_key_policy, info->extack); 928 + int err = nla_parse_nested_deprecated(tb, NL80211_KEY_MAX, key, 929 + nl80211_key_policy, 930 + info->extack); 932 931 if (err) 933 932 return err; 934 933 ··· 965 962 if (tb[NL80211_KEY_DEFAULT_TYPES]) { 966 963 struct nlattr *kdt[NUM_NL80211_KEY_DEFAULT_TYPES]; 967 964 968 - err = nla_parse_nested(kdt, NUM_NL80211_KEY_DEFAULT_TYPES - 1, 969 - tb[NL80211_KEY_DEFAULT_TYPES], 970 - nl80211_key_default_policy, 971 - info->extack); 965 + err = nla_parse_nested_deprecated(kdt, 966 + NUM_NL80211_KEY_DEFAULT_TYPES - 1, 967 + tb[NL80211_KEY_DEFAULT_TYPES], 968 + nl80211_key_default_policy, 969 + info->extack); 972 970 if (err) 973 971 return err; 974 972 ··· 1016 1012 1017 1013 if (info->attrs[NL80211_ATTR_KEY_DEFAULT_TYPES]) { 1018 1014 struct nlattr *kdt[NUM_NL80211_KEY_DEFAULT_TYPES]; 1019 - int err = nla_parse_nested(kdt, 1020 - NUM_NL80211_KEY_DEFAULT_TYPES - 1, 1021 - info->attrs[NL80211_ATTR_KEY_DEFAULT_TYPES], 1022 - nl80211_key_default_policy, 1023 - info->extack); 1015 + int err = nla_parse_nested_deprecated(kdt, 1016 + NUM_NL80211_KEY_DEFAULT_TYPES - 1, 1017 + info->attrs[NL80211_ATTR_KEY_DEFAULT_TYPES], 1018 + nl80211_key_default_policy, 1019 + info->extack); 1024 1020 if (err) 1025 1021 return err; 1026 1022 ··· 2321 2317 struct nl80211_dump_wiphy_state *state) 2322 2318 { 2323 2319 struct nlattr **tb = genl_family_attrbuf(&nl80211_fam); 2324 - int ret = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize, tb, 2325 - nl80211_fam.maxattr, nl80211_policy, NULL); 2320 + int ret = nlmsg_parse_deprecated(cb->nlh, 2321 + GENL_HDRLEN + nl80211_fam.hdrsize, 2322 + tb, nl80211_fam.maxattr, 2323 + nl80211_policy, NULL); 2326 2324 /* ignore parse errors for backward compatibility */ 2327 2325 if (ret) 2328 2326 return 0; ··· 2767 2761 nla_for_each_nested(nl_txq_params, 2768 2762 info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS], 2769 2763 rem_txq_params) { 2770 - result = nla_parse_nested(tb, NL80211_TXQ_ATTR_MAX, 2771 - nl_txq_params, 2772 - txq_params_policy, 2773 - info->extack); 2764 + result = nla_parse_nested_deprecated(tb, 2765 + NL80211_TXQ_ATTR_MAX, 2766 + nl_txq_params, 2767 + txq_params_policy, 2768 + info->extack); 2774 2769 if (result) 2775 2770 return result; 2776 2771 result = parse_txq_params(tb, &txq_params); ··· 3228 3221 if (!nla) 3229 3222 return -EINVAL; 3230 3223 3231 - if (nla_parse_nested(flags, NL80211_MNTR_FLAG_MAX, nla, 3232 - mntr_flags_policy, NULL)) 3224 + if (nla_parse_nested_deprecated(flags, NL80211_MNTR_FLAG_MAX, nla, mntr_flags_policy, NULL)) 3233 3225 return -EINVAL; 3234 3226 3235 3227 for (flag = 1; flag <= NL80211_MNTR_FLAG_MAX; flag++) ··· 4107 4101 sband = rdev->wiphy.bands[band]; 4108 4102 if (sband == NULL) 4109 4103 return -EINVAL; 4110 - err = nla_parse_nested(tb, NL80211_TXRATE_MAX, tx_rates, 4111 - nl80211_txattr_policy, info->extack); 4104 + err = nla_parse_nested_deprecated(tb, NL80211_TXRATE_MAX, 4105 + tx_rates, 4106 + nl80211_txattr_policy, 4107 + info->extack); 4112 4108 if (err) 4113 4109 return err; 4114 4110 if (tb[NL80211_TXRATE_LEGACY]) { ··· 4278 4270 if (attrs[NL80211_ATTR_FTM_RESPONDER]) { 4279 4271 struct nlattr *tb[NL80211_FTM_RESP_ATTR_MAX + 1]; 4280 4272 4281 - err = nla_parse_nested(tb, NL80211_FTM_RESP_ATTR_MAX, 4282 - attrs[NL80211_ATTR_FTM_RESPONDER], 4283 - NULL, NULL); 4273 + err = nla_parse_nested_deprecated(tb, 4274 + NL80211_FTM_RESP_ATTR_MAX, 4275 + attrs[NL80211_ATTR_FTM_RESPONDER], 4276 + NULL, NULL); 4284 4277 if (err) 4285 4278 return err; 4286 4279 ··· 4689 4680 if (!nla) 4690 4681 return 0; 4691 4682 4692 - if (nla_parse_nested(flags, NL80211_STA_FLAG_MAX, nla, 4693 - sta_flags_policy, info->extack)) 4683 + if (nla_parse_nested_deprecated(flags, NL80211_STA_FLAG_MAX, nla, sta_flags_policy, info->extack)) 4694 4684 return -EINVAL; 4695 4685 4696 4686 /* ··· 5358 5350 return 0; 5359 5351 5360 5352 nla = info->attrs[NL80211_ATTR_STA_WME]; 5361 - err = nla_parse_nested(tb, NL80211_STA_WME_MAX, nla, 5362 - nl80211_sta_wme_policy, info->extack); 5353 + err = nla_parse_nested_deprecated(tb, NL80211_STA_WME_MAX, nla, 5354 + nl80211_sta_wme_policy, 5355 + info->extack); 5363 5356 if (err) 5364 5357 return err; 5365 5358 ··· 6500 6491 6501 6492 if (!info->attrs[NL80211_ATTR_MESH_CONFIG]) 6502 6493 return -EINVAL; 6503 - if (nla_parse_nested(tb, NL80211_MESHCONF_ATTR_MAX, 6504 - info->attrs[NL80211_ATTR_MESH_CONFIG], 6505 - nl80211_meshconf_params_policy, info->extack)) 6494 + if (nla_parse_nested_deprecated(tb, NL80211_MESHCONF_ATTR_MAX, info->attrs[NL80211_ATTR_MESH_CONFIG], nl80211_meshconf_params_policy, info->extack)) 6506 6495 return -EINVAL; 6507 6496 6508 6497 /* This makes sure that there aren't more than 32 mesh config ··· 6633 6626 6634 6627 if (!info->attrs[NL80211_ATTR_MESH_SETUP]) 6635 6628 return -EINVAL; 6636 - if (nla_parse_nested(tb, NL80211_MESH_SETUP_ATTR_MAX, 6637 - info->attrs[NL80211_ATTR_MESH_SETUP], 6638 - nl80211_mesh_setup_params_policy, info->extack)) 6629 + if (nla_parse_nested_deprecated(tb, NL80211_MESH_SETUP_ATTR_MAX, info->attrs[NL80211_ATTR_MESH_SETUP], nl80211_mesh_setup_params_policy, info->extack)) 6639 6630 return -EINVAL; 6640 6631 6641 6632 if (tb[NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC]) ··· 7017 7012 7018 7013 nla_for_each_nested(nl_reg_rule, info->attrs[NL80211_ATTR_REG_RULES], 7019 7014 rem_reg_rules) { 7020 - r = nla_parse_nested(tb, NL80211_REG_RULE_ATTR_MAX, 7021 - nl_reg_rule, reg_rule_policy, 7022 - info->extack); 7015 + r = nla_parse_nested_deprecated(tb, NL80211_REG_RULE_ATTR_MAX, 7016 + nl_reg_rule, reg_rule_policy, 7017 + info->extack); 7023 7018 if (r) 7024 7019 goto bad_reg; 7025 7020 r = parse_reg_rule(tb, &rd->reg_rules[rule_idx]); ··· 7090 7085 if (!nla_ok(nest, nla_len(nest))) 7091 7086 return -EINVAL; 7092 7087 7093 - err = nla_parse_nested(attr, NL80211_BSS_SELECT_ATTR_MAX, nest, 7094 - nl80211_bss_select_policy, NULL); 7088 + err = nla_parse_nested_deprecated(attr, NL80211_BSS_SELECT_ATTR_MAX, 7089 + nest, nl80211_bss_select_policy, 7090 + NULL); 7095 7091 if (err) 7096 7092 return err; 7097 7093 ··· 7585 7579 if (WARN_ON(i >= n_plans)) 7586 7580 return -EINVAL; 7587 7581 7588 - err = nla_parse_nested(plan, NL80211_SCHED_SCAN_PLAN_MAX, 7589 - attr, nl80211_plan_policy, NULL); 7582 + err = nla_parse_nested_deprecated(plan, 7583 + NL80211_SCHED_SCAN_PLAN_MAX, 7584 + attr, nl80211_plan_policy, 7585 + NULL); 7590 7586 if (err) 7591 7587 return err; 7592 7588 ··· 7709 7701 tmp) { 7710 7702 struct nlattr *rssi; 7711 7703 7712 - err = nla_parse_nested(tb, 7713 - NL80211_SCHED_SCAN_MATCH_ATTR_MAX, 7714 - attr, nl80211_match_policy, 7715 - NULL); 7704 + err = nla_parse_nested_deprecated(tb, 7705 + NL80211_SCHED_SCAN_MATCH_ATTR_MAX, 7706 + attr, 7707 + nl80211_match_policy, 7708 + NULL); 7716 7709 if (err) 7717 7710 return ERR_PTR(err); 7718 7711 ··· 7897 7888 tmp) { 7898 7889 struct nlattr *ssid, *bssid, *rssi; 7899 7890 7900 - err = nla_parse_nested(tb, 7901 - NL80211_SCHED_SCAN_MATCH_ATTR_MAX, 7902 - attr, nl80211_match_policy, 7903 - NULL); 7891 + err = nla_parse_nested_deprecated(tb, 7892 + NL80211_SCHED_SCAN_MATCH_ATTR_MAX, 7893 + attr, 7894 + nl80211_match_policy, 7895 + NULL); 7904 7896 if (err) 7905 7897 goto out_free; 7906 7898 ssid = tb[NL80211_SCHED_SCAN_MATCH_ATTR_SSID]; ··· 8285 8275 if (err) 8286 8276 return err; 8287 8277 8288 - err = nla_parse_nested(csa_attrs, NL80211_ATTR_MAX, 8289 - info->attrs[NL80211_ATTR_CSA_IES], 8290 - nl80211_policy, info->extack); 8278 + err = nla_parse_nested_deprecated(csa_attrs, NL80211_ATTR_MAX, 8279 + info->attrs[NL80211_ATTR_CSA_IES], 8280 + nl80211_policy, info->extack); 8291 8281 if (err) 8292 8282 return err; 8293 8283 ··· 9562 9552 } else { 9563 9553 struct nlattr **attrbuf = genl_family_attrbuf(&nl80211_fam); 9564 9554 9565 - err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize, 9566 - attrbuf, nl80211_fam.maxattr, 9567 - nl80211_policy, NULL); 9555 + err = nlmsg_parse_deprecated(cb->nlh, 9556 + GENL_HDRLEN + nl80211_fam.hdrsize, 9557 + attrbuf, nl80211_fam.maxattr, 9558 + nl80211_policy, NULL); 9568 9559 if (err) 9569 9560 goto out_err; 9570 9561 ··· 10689 10678 if (!cqm) 10690 10679 return -EINVAL; 10691 10680 10692 - err = nla_parse_nested(attrs, NL80211_ATTR_CQM_MAX, cqm, 10693 - nl80211_attr_cqm_policy, info->extack); 10681 + err = nla_parse_nested_deprecated(attrs, NL80211_ATTR_CQM_MAX, cqm, 10682 + nl80211_attr_cqm_policy, 10683 + info->extack); 10694 10684 if (err) 10695 10685 return err; 10696 10686 ··· 11129 11117 if (!rdev->wiphy.wowlan->tcp) 11130 11118 return -EINVAL; 11131 11119 11132 - err = nla_parse_nested(tb, MAX_NL80211_WOWLAN_TCP, attr, 11133 - nl80211_wowlan_tcp_policy, NULL); 11120 + err = nla_parse_nested_deprecated(tb, MAX_NL80211_WOWLAN_TCP, attr, 11121 + nl80211_wowlan_tcp_policy, NULL); 11134 11122 if (err) 11135 11123 return err; 11136 11124 ··· 11275 11263 goto out; 11276 11264 } 11277 11265 11278 - err = nla_parse_nested(tb, NL80211_ATTR_MAX, attr, nl80211_policy, 11279 - NULL); 11266 + err = nla_parse_nested_deprecated(tb, NL80211_ATTR_MAX, attr, 11267 + nl80211_policy, NULL); 11280 11268 if (err) 11281 11269 goto out; 11282 11270 ··· 11311 11299 goto set_wakeup; 11312 11300 } 11313 11301 11314 - err = nla_parse_nested(tb, MAX_NL80211_WOWLAN_TRIG, 11315 - info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS], 11316 - nl80211_wowlan_policy, info->extack); 11302 + err = nla_parse_nested_deprecated(tb, MAX_NL80211_WOWLAN_TRIG, 11303 + info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS], 11304 + nl80211_wowlan_policy, info->extack); 11317 11305 if (err) 11318 11306 return err; 11319 11307 ··· 11395 11383 rem) { 11396 11384 u8 *mask_pat; 11397 11385 11398 - err = nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat, 11399 - nl80211_packet_pattern_policy, 11400 - info->extack); 11386 + err = nla_parse_nested_deprecated(pat_tb, 11387 + MAX_NL80211_PKTPAT, 11388 + pat, 11389 + nl80211_packet_pattern_policy, 11390 + info->extack); 11401 11391 if (err) 11402 11392 goto error; 11403 11393 ··· 11612 11598 int rem, pat_len, mask_len, pkt_offset, n_patterns = 0; 11613 11599 struct nlattr *pat_tb[NUM_NL80211_PKTPAT]; 11614 11600 11615 - err = nla_parse_nested(tb, NL80211_ATTR_COALESCE_RULE_MAX, rule, 11616 - nl80211_coalesce_policy, NULL); 11601 + err = nla_parse_nested_deprecated(tb, NL80211_ATTR_COALESCE_RULE_MAX, 11602 + rule, nl80211_coalesce_policy, NULL); 11617 11603 if (err) 11618 11604 return err; 11619 11605 ··· 11648 11634 rem) { 11649 11635 u8 *mask_pat; 11650 11636 11651 - err = nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat, 11652 - nl80211_packet_pattern_policy, NULL); 11637 + err = nla_parse_nested_deprecated(pat_tb, MAX_NL80211_PKTPAT, 11638 + pat, 11639 + nl80211_packet_pattern_policy, 11640 + NULL); 11653 11641 if (err) 11654 11642 return err; 11655 11643 ··· 11773 11757 if (!info->attrs[NL80211_ATTR_REKEY_DATA]) 11774 11758 return -EINVAL; 11775 11759 11776 - err = nla_parse_nested(tb, MAX_NL80211_REKEY_DATA, 11777 - info->attrs[NL80211_ATTR_REKEY_DATA], 11778 - nl80211_rekey_policy, info->extack); 11760 + err = nla_parse_nested_deprecated(tb, MAX_NL80211_REKEY_DATA, 11761 + info->attrs[NL80211_ATTR_REKEY_DATA], 11762 + nl80211_rekey_policy, info->extack); 11779 11763 if (err) 11780 11764 return err; 11781 11765 ··· 12087 12071 if (!info->attrs[NL80211_ATTR_NAN_FUNC]) 12088 12072 return -EINVAL; 12089 12073 12090 - err = nla_parse_nested(tb, NL80211_NAN_FUNC_ATTR_MAX, 12091 - info->attrs[NL80211_ATTR_NAN_FUNC], 12092 - nl80211_nan_func_policy, info->extack); 12074 + err = nla_parse_nested_deprecated(tb, NL80211_NAN_FUNC_ATTR_MAX, 12075 + info->attrs[NL80211_ATTR_NAN_FUNC], 12076 + nl80211_nan_func_policy, 12077 + info->extack); 12093 12078 if (err) 12094 12079 return err; 12095 12080 ··· 12186 12169 if (tb[NL80211_NAN_FUNC_SRF]) { 12187 12170 struct nlattr *srf_tb[NUM_NL80211_NAN_SRF_ATTR]; 12188 12171 12189 - err = nla_parse_nested(srf_tb, NL80211_NAN_SRF_ATTR_MAX, 12190 - tb[NL80211_NAN_FUNC_SRF], 12191 - nl80211_nan_srf_policy, info->extack); 12172 + err = nla_parse_nested_deprecated(srf_tb, 12173 + NL80211_NAN_SRF_ATTR_MAX, 12174 + tb[NL80211_NAN_FUNC_SRF], 12175 + nl80211_nan_srf_policy, 12176 + info->extack); 12192 12177 if (err) 12193 12178 goto out; 12194 12179 ··· 12723 12704 return 0; 12724 12705 } 12725 12706 12726 - err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize, attrbuf, 12727 - nl80211_fam.maxattr, nl80211_policy, NULL); 12707 + err = nlmsg_parse_deprecated(cb->nlh, 12708 + GENL_HDRLEN + nl80211_fam.hdrsize, 12709 + attrbuf, nl80211_fam.maxattr, 12710 + nl80211_policy, NULL); 12728 12711 if (err) 12729 12712 return err; 12730 12713
+10 -8
net/wireless/pmsr.c
··· 25 25 } 26 26 27 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 31 if (tb[NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE]) 31 32 preamble = nla_get_u32(tb[NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE]); ··· 140 139 int err, rem; 141 140 142 141 /* no validation needed - was already done via nested policy */ 143 - nla_parse_nested(tb, NL80211_PMSR_PEER_ATTR_MAX, peer, NULL, NULL); 142 + nla_parse_nested_deprecated(tb, NL80211_PMSR_PEER_ATTR_MAX, peer, 143 + NULL, NULL); 144 144 145 145 if (!tb[NL80211_PMSR_PEER_ATTR_ADDR] || 146 146 !tb[NL80211_PMSR_PEER_ATTR_CHAN] || ··· 156 154 /* reuse info->attrs */ 157 155 memset(info->attrs, 0, sizeof(*info->attrs) * (NL80211_ATTR_MAX + 1)); 158 156 /* need to validate here, we don't want to have validation recursion */ 159 - err = nla_parse_nested(info->attrs, NL80211_ATTR_MAX, 160 - tb[NL80211_PMSR_PEER_ATTR_CHAN], 161 - nl80211_policy, info->extack); 157 + err = nla_parse_nested_deprecated(info->attrs, NL80211_ATTR_MAX, 158 + tb[NL80211_PMSR_PEER_ATTR_CHAN], 159 + nl80211_policy, info->extack); 162 160 if (err) 163 161 return err; 164 162 ··· 167 165 return err; 168 166 169 167 /* no validation needed - was already done via nested policy */ 170 - nla_parse_nested(req, NL80211_PMSR_REQ_ATTR_MAX, 171 - tb[NL80211_PMSR_PEER_ATTR_REQ], 172 - NULL, NULL); 168 + nla_parse_nested_deprecated(req, NL80211_PMSR_REQ_ATTR_MAX, 169 + tb[NL80211_PMSR_PEER_ATTR_REQ], NULL, 170 + NULL); 173 171 174 172 if (!req[NL80211_PMSR_REQ_ATTR_DATA]) { 175 173 NL_SET_ERR_MSG_ATTR(info->extack,
+5 -5
net/xfrm/xfrm_user.c
··· 1006 1006 u8 proto = 0; 1007 1007 int err; 1008 1008 1009 - err = nlmsg_parse(cb->nlh, 0, attrs, XFRMA_MAX, xfrma_policy, 1010 - cb->extack); 1009 + err = nlmsg_parse_deprecated(cb->nlh, 0, attrs, XFRMA_MAX, 1010 + xfrma_policy, cb->extack); 1011 1011 if (err < 0) 1012 1012 return err; 1013 1013 ··· 2656 2656 } 2657 2657 } 2658 2658 2659 - err = nlmsg_parse(nlh, xfrm_msg_min[type], attrs, 2660 - link->nla_max ? : XFRMA_MAX, 2661 - link->nla_pol ? : xfrma_policy, extack); 2659 + err = nlmsg_parse_deprecated(nlh, xfrm_msg_min[type], attrs, 2660 + link->nla_max ? : XFRMA_MAX, 2661 + link->nla_pol ? : xfrma_policy, extack); 2662 2662 if (err < 0) 2663 2663 return err; 2664 2664