Message ID | 20250414-nlmsg-v2-0-3d90cb42c6af@debian.org (mailing list archive) |
---|---|
Headers | show |
Series | net: Introduce nlmsg_payload helper | expand |
Hello: This series was applied to netdev/net-next.git (main) by Jakub Kicinski <kuba@kernel.org>: On Mon, 14 Apr 2025 06:24:06 -0700 you wrote: > In the current codebase, there are multiple instances where the > structure size is checked before assigning it to a Netlink message. This > check is crucial for ensuring that the structure is correctly mapped > onto the Netlink message, providing a layer of security. > > To streamline this process, Jakub Kicinski suggested creating a helper > function, `nlmsg_payload`, which verifies if the structure fits within > the message. If it does, the function returns the data; otherwise, it > returns NULL. This approach simplifies the code and reduces redundancy. > > [...] Here is the summary with links: - [net-next,v2,01/10] netlink: Introduce nlmsg_payload helper https://git.kernel.org/netdev/net-next/c/95d06e92a401 - [net-next,v2,02/10] neighbour: Use nlmsg_payload in neightbl_valid_dump_info https://git.kernel.org/netdev/net-next/c/7527efe8a416 - [net-next,v2,03/10] neighbour: Use nlmsg_payload in neigh_valid_get_req https://git.kernel.org/netdev/net-next/c/2d1f827f0642 - [net-next,v2,04/10] rtnetlink: Use nlmsg_payload in valid_fdb_dump_strict https://git.kernel.org/netdev/net-next/c/77d02290366f - [net-next,v2,05/10] mpls: Use nlmsg_payload in mpls_valid_fib_dump_req https://git.kernel.org/netdev/net-next/c/72be72bea9dc - [net-next,v2,06/10] ipv6: Use nlmsg_payload in inet6_valid_dump_ifaddr_req https://git.kernel.org/netdev/net-next/c/e87187dfbb9f - [net-next,v2,07/10] ipv6: Use nlmsg_payload in inet6_rtm_valid_getaddr_req https://git.kernel.org/netdev/net-next/c/8cf1e30907de - [net-next,v2,08/10] mpls: Use nlmsg_payload in mpls_valid_getroute_req https://git.kernel.org/netdev/net-next/c/69a1ecfe47f0 - [net-next,v2,09/10] net: fib_rules: Use nlmsg_payload in fib_valid_dumprule_req https://git.kernel.org/netdev/net-next/c/4c113c803fdc - [net-next,v2,10/10] net: fib_rules: Use nlmsg_payload in fib_{new,del}rule() https://git.kernel.org/netdev/net-next/c/8ff953036110 You are awesome, thank you!
In the current codebase, there are multiple instances where the structure size is checked before assigning it to a Netlink message. This check is crucial for ensuring that the structure is correctly mapped onto the Netlink message, providing a layer of security. To streamline this process, Jakub Kicinski suggested creating a helper function, `nlmsg_payload`, which verifies if the structure fits within the message. If it does, the function returns the data; otherwise, it returns NULL. This approach simplifies the code and reduces redundancy. This patchset introduces the `nlmsg_payload` helper and updates several parts of the code to use it. Further updates will follow in subsequent patchsets. Signed-off-by: Breno Leitao <leitao@debian.org> --- Changes in v2: - Add the "Return" kdoc entry for nlmsg_payload() (Jakub) - Use the same function in some other places (Kuniyuki Iwashima) - Link to v1: https://lore.kernel.org/r/20250411-nlmsg-v1-0-ddd4e065cb15@debian.org --- Breno Leitao (10): netlink: Introduce nlmsg_payload helper neighbour: Use nlmsg_payload in neightbl_valid_dump_info neighbour: Use nlmsg_payload in neigh_valid_get_req rtnetlink: Use nlmsg_payload in valid_fdb_dump_strict mpls: Use nlmsg_payload in mpls_valid_fib_dump_req ipv6: Use nlmsg_payload in inet6_valid_dump_ifaddr_req ipv6: Use nlmsg_payload in inet6_rtm_valid_getaddr_req mpls: Use nlmsg_payload in mpls_valid_getroute_req net: fib_rules: Use nlmsg_payload in fib_valid_dumprule_req net: fib_rules: Use nlmsg_payload in fib_{new,del}rule() include/net/netlink.h | 16 ++++++++++++++++ net/core/fib_rules.c | 14 ++++++++------ net/core/neighbour.c | 8 ++++---- net/core/rtnetlink.c | 4 ++-- net/ipv6/addrconf.c | 8 ++++---- net/mpls/af_mpls.c | 8 ++++---- 6 files changed, 38 insertions(+), 20 deletions(-) --- base-commit: 6a325aed130bb68790e765f923e76ec5669d2da7 change-id: 20250411-nlmsg-2dd8c30ba35c Best regards,