netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/9] net: Introduce nlmsg_payload helper
@ 2025-04-11 17:00 Breno Leitao
  2025-04-11 17:00 ` [PATCH net-next 1/9] netlink: " Breno Leitao
                   ` (8 more replies)
  0 siblings, 9 replies; 21+ messages in thread
From: Breno Leitao @ 2025-04-11 17:00 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, David Ahern
  Cc: netdev, linux-kernel, Breno Leitao

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>
---
Breno Leitao (9):
      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

 include/net/netlink.h | 13 +++++++++++++
 net/core/fib_rules.c  |  4 ++--
 net/core/neighbour.c  |  8 ++++----
 net/core/rtnetlink.c  |  4 ++--
 net/ipv6/addrconf.c   |  8 ++++----
 net/mpls/af_mpls.c    |  8 ++++----
 6 files changed, 29 insertions(+), 16 deletions(-)
---
base-commit: 0c49baf099ba2147a6ff3bbdc3197c6ddbee5469
change-id: 20250411-nlmsg-2dd8c30ba35c

Best regards,
-- 
Breno Leitao <leitao@debian.org>


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2025-04-14 12:03 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-11 17:00 [PATCH net-next 0/9] net: Introduce nlmsg_payload helper Breno Leitao
2025-04-11 17:00 ` [PATCH net-next 1/9] netlink: " Breno Leitao
2025-04-11 21:12   ` Kuniyuki Iwashima
2025-04-11 23:01   ` Jakub Kicinski
2025-04-11 17:00 ` [PATCH net-next 2/9] neighbour: Use nlmsg_payload in neightbl_valid_dump_info Breno Leitao
2025-04-11 21:19   ` Kuniyuki Iwashima
2025-04-11 17:00 ` [PATCH net-next 3/9] neighbour: Use nlmsg_payload in neigh_valid_get_req Breno Leitao
2025-04-11 21:22   ` Kuniyuki Iwashima
2025-04-11 17:00 ` [PATCH net-next 4/9] rtnetlink: Use nlmsg_payload in valid_fdb_dump_strict Breno Leitao
2025-04-11 21:25   ` Kuniyuki Iwashima
2025-04-11 17:00 ` [PATCH net-next 5/9] mpls: Use nlmsg_payload in mpls_valid_fib_dump_req Breno Leitao
2025-04-11 21:28   ` Kuniyuki Iwashima
2025-04-11 17:00 ` [PATCH net-next 6/9] ipv6: Use nlmsg_payload in inet6_valid_dump_ifaddr_req Breno Leitao
2025-04-11 21:29   ` Kuniyuki Iwashima
2025-04-11 17:00 ` [PATCH net-next 7/9] ipv6: Use nlmsg_payload in inet6_rtm_valid_getaddr_req Breno Leitao
2025-04-11 21:33   ` Kuniyuki Iwashima
2025-04-11 17:00 ` [PATCH net-next 8/9] mpls: Use nlmsg_payload in mpls_valid_getroute_req Breno Leitao
2025-04-11 21:34   ` Kuniyuki Iwashima
2025-04-11 17:00 ` [PATCH net-next 9/9] net: fib_rules: Use nlmsg_payload in fib_valid_dumprule_req Breno Leitao
2025-04-11 21:38   ` Kuniyuki Iwashima
2025-04-14 12:03     ` Breno Leitao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).