mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 23:52:08 +02:00
Merge branch 'net-adopting-nlmsg_payload-final-series'
Breno Leitao says: ==================== net: Adopting nlmsg_payload() (final series) This patchset marks the final step in converting users to the new nlmsg_payload() function. It addresses the last two files that were not converted in previous series, specifically updating the following functions: neigh_valid_dump_req rtnl_valid_dump_ifinfo_req rtnl_valid_getlink_req valid_fdb_get_strict valid_bridge_getlink_req rtnl_valid_stats_req rtnl_mdb_valid_dump_req I would like to extend a big thank you to Kuniyuki Iwashima for his invaluable help and review of this effort. ==================== Link: https://patch.msgid.link/20250417-nlmsg_v3-v1-0-9b09d9d7e61d@debian.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
544456b3b4
|
|
@ -2747,12 +2747,12 @@ static int neigh_valid_dump_req(const struct nlmsghdr *nlh,
|
|||
if (strict_check) {
|
||||
struct ndmsg *ndm;
|
||||
|
||||
if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*ndm))) {
|
||||
ndm = nlmsg_payload(nlh, sizeof(*ndm));
|
||||
if (!ndm) {
|
||||
NL_SET_ERR_MSG(extack, "Invalid header for neighbor dump request");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ndm = nlmsg_data(nlh);
|
||||
if (ndm->ndm_pad1 || ndm->ndm_pad2 || ndm->ndm_ifindex ||
|
||||
ndm->ndm_state || ndm->ndm_type) {
|
||||
NL_SET_ERR_MSG(extack, "Invalid values in header for neighbor dump request");
|
||||
|
|
|
|||
|
|
@ -2390,12 +2390,12 @@ static int rtnl_valid_dump_ifinfo_req(const struct nlmsghdr *nlh,
|
|||
if (strict_check) {
|
||||
struct ifinfomsg *ifm;
|
||||
|
||||
if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*ifm))) {
|
||||
ifm = nlmsg_payload(nlh, sizeof(*ifm));
|
||||
if (!ifm) {
|
||||
NL_SET_ERR_MSG(extack, "Invalid header for link dump");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ifm = nlmsg_data(nlh);
|
||||
if (ifm->__ifi_pad || ifm->ifi_type || ifm->ifi_flags ||
|
||||
ifm->ifi_change) {
|
||||
NL_SET_ERR_MSG(extack, "Invalid values in header for link dump request");
|
||||
|
|
@ -4084,7 +4084,8 @@ static int rtnl_valid_getlink_req(struct sk_buff *skb,
|
|||
struct ifinfomsg *ifm;
|
||||
int i, err;
|
||||
|
||||
if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*ifm))) {
|
||||
ifm = nlmsg_payload(nlh, sizeof(*ifm));
|
||||
if (!ifm) {
|
||||
NL_SET_ERR_MSG(extack, "Invalid header for get link");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -4093,7 +4094,6 @@ static int rtnl_valid_getlink_req(struct sk_buff *skb,
|
|||
return nlmsg_parse_deprecated(nlh, sizeof(*ifm), tb, IFLA_MAX,
|
||||
ifla_policy, extack);
|
||||
|
||||
ifm = nlmsg_data(nlh);
|
||||
if (ifm->__ifi_pad || ifm->ifi_type || ifm->ifi_flags ||
|
||||
ifm->ifi_change) {
|
||||
NL_SET_ERR_MSG(extack, "Invalid values in header for get link request");
|
||||
|
|
@ -5052,12 +5052,12 @@ static int valid_fdb_get_strict(const struct nlmsghdr *nlh,
|
|||
struct ndmsg *ndm;
|
||||
int err, i;
|
||||
|
||||
if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*ndm))) {
|
||||
ndm = nlmsg_payload(nlh, sizeof(*ndm));
|
||||
if (!ndm) {
|
||||
NL_SET_ERR_MSG(extack, "Invalid header for fdb get request");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ndm = nlmsg_data(nlh);
|
||||
if (ndm->ndm_pad1 || ndm->ndm_pad2 || ndm->ndm_state ||
|
||||
ndm->ndm_type) {
|
||||
NL_SET_ERR_MSG(extack, "Invalid values in header for fdb get request");
|
||||
|
|
@ -5324,12 +5324,12 @@ static int valid_bridge_getlink_req(const struct nlmsghdr *nlh,
|
|||
if (strict_check) {
|
||||
struct ifinfomsg *ifm;
|
||||
|
||||
if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*ifm))) {
|
||||
ifm = nlmsg_payload(nlh, sizeof(*ifm));
|
||||
if (!ifm) {
|
||||
NL_SET_ERR_MSG(extack, "Invalid header for bridge link dump");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ifm = nlmsg_data(nlh);
|
||||
if (ifm->__ifi_pad || ifm->ifi_type || ifm->ifi_flags ||
|
||||
ifm->ifi_change || ifm->ifi_index) {
|
||||
NL_SET_ERR_MSG(extack, "Invalid values in header for bridge link dump request");
|
||||
|
|
@ -6221,7 +6221,8 @@ static int rtnl_valid_stats_req(const struct nlmsghdr *nlh, bool strict_check,
|
|||
{
|
||||
struct if_stats_msg *ifsm;
|
||||
|
||||
if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*ifsm))) {
|
||||
ifsm = nlmsg_payload(nlh, sizeof(*ifsm));
|
||||
if (!ifsm) {
|
||||
NL_SET_ERR_MSG(extack, "Invalid header for stats dump");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -6229,8 +6230,6 @@ static int rtnl_valid_stats_req(const struct nlmsghdr *nlh, bool strict_check,
|
|||
if (!strict_check)
|
||||
return 0;
|
||||
|
||||
ifsm = nlmsg_data(nlh);
|
||||
|
||||
/* only requests using strict checks can pass data to influence
|
||||
* the dump. The legacy exception is filter_mask.
|
||||
*/
|
||||
|
|
@ -6458,12 +6457,12 @@ static int rtnl_mdb_valid_dump_req(const struct nlmsghdr *nlh,
|
|||
{
|
||||
struct br_port_msg *bpm;
|
||||
|
||||
if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*bpm))) {
|
||||
bpm = nlmsg_payload(nlh, sizeof(*bpm));
|
||||
if (!bpm) {
|
||||
NL_SET_ERR_MSG(extack, "Invalid header for mdb dump request");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
bpm = nlmsg_data(nlh);
|
||||
if (bpm->ifindex) {
|
||||
NL_SET_ERR_MSG(extack, "Filtering by device index is not supported for mdb dump request");
|
||||
return -EINVAL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user