* [PATCH net-next 1/8] ipv6: Use nlmsg_payload in addrlabel file
2025-04-15 19:28 [PATCH net-next 0/8] Adopting nlmsg_payload() in IPv4/IPv6 Breno Leitao
@ 2025-04-15 19:28 ` Breno Leitao
2025-04-16 0:54 ` Kuniyuki Iwashima
2025-04-15 19:28 ` [PATCH net-next 2/8] ipv6: Use nlmsg_payload in addrconf file Breno Leitao
` (7 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Breno Leitao @ 2025-04-15 19:28 UTC (permalink / raw)
To: kuniyu, David S. Miller, David Ahern, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn
Cc: netdev, linux-kernel, Breno Leitao, kernel-team
Leverage the new nlmsg_payload() helper to avoid checking for message
size and then reading the nlmsg data.
This changes function ip6addrlbl_valid_get_req() and
ip6addrlbl_valid_dump_req().
Signed-off-by: Breno Leitao <leitao@debian.org>
---
net/ipv6/addrlabel.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c
index ab054f329e12d..fb63ffbcfc647 100644
--- a/net/ipv6/addrlabel.c
+++ b/net/ipv6/addrlabel.c
@@ -473,12 +473,12 @@ static int ip6addrlbl_valid_dump_req(const struct nlmsghdr *nlh,
{
struct ifaddrlblmsg *ifal;
- if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*ifal))) {
+ ifal = nlmsg_payload(nlh, sizeof(*ifal));
+ if (!ifal) {
NL_SET_ERR_MSG_MOD(extack, "Invalid header for address label dump request");
return -EINVAL;
}
- ifal = nlmsg_data(nlh);
if (ifal->__ifal_reserved || ifal->ifal_prefixlen ||
ifal->ifal_flags || ifal->ifal_index || ifal->ifal_seq) {
NL_SET_ERR_MSG_MOD(extack, "Invalid values in header for address label dump request");
@@ -543,7 +543,8 @@ static int ip6addrlbl_valid_get_req(struct sk_buff *skb,
struct ifaddrlblmsg *ifal;
int i, err;
- if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*ifal))) {
+ ifal = nlmsg_payload(nlh, sizeof(*ifal));
+ if (!ifal) {
NL_SET_ERR_MSG_MOD(extack, "Invalid header for addrlabel get request");
return -EINVAL;
}
@@ -552,7 +553,6 @@ static int ip6addrlbl_valid_get_req(struct sk_buff *skb,
return nlmsg_parse_deprecated(nlh, sizeof(*ifal), tb,
IFAL_MAX, ifal_policy, extack);
- ifal = nlmsg_data(nlh);
if (ifal->__ifal_reserved || ifal->ifal_flags || ifal->ifal_seq) {
NL_SET_ERR_MSG_MOD(extack, "Invalid values in header for addrlabel get request");
return -EINVAL;
--
2.47.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH net-next 1/8] ipv6: Use nlmsg_payload in addrlabel file
2025-04-15 19:28 ` [PATCH net-next 1/8] ipv6: Use nlmsg_payload in addrlabel file Breno Leitao
@ 2025-04-16 0:54 ` Kuniyuki Iwashima
0 siblings, 0 replies; 19+ messages in thread
From: Kuniyuki Iwashima @ 2025-04-16 0:54 UTC (permalink / raw)
To: leitao
Cc: andrew+netdev, davem, dsahern, edumazet, horms, kernel-team, kuba,
kuniyu, linux-kernel, netdev, pabeni
From: Breno Leitao <leitao@debian.org>
Date: Tue, 15 Apr 2025 12:28:52 -0700
> Leverage the new nlmsg_payload() helper to avoid checking for message
> size and then reading the nlmsg data.
>
> This changes function ip6addrlbl_valid_get_req() and
> ip6addrlbl_valid_dump_req().
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net-next 2/8] ipv6: Use nlmsg_payload in addrconf file
2025-04-15 19:28 [PATCH net-next 0/8] Adopting nlmsg_payload() in IPv4/IPv6 Breno Leitao
2025-04-15 19:28 ` [PATCH net-next 1/8] ipv6: Use nlmsg_payload in addrlabel file Breno Leitao
@ 2025-04-15 19:28 ` Breno Leitao
2025-04-16 0:56 ` Kuniyuki Iwashima
2025-04-15 19:28 ` [PATCH net-next 3/8] ipv6: Use nlmsg_payload in route file Breno Leitao
` (6 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Breno Leitao @ 2025-04-15 19:28 UTC (permalink / raw)
To: kuniyu, David S. Miller, David Ahern, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn
Cc: netdev, linux-kernel, Breno Leitao, kernel-team
Leverage the new nlmsg_payload() helper to avoid checking for message
size and then reading the nlmsg data.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
net/ipv6/addrconf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 4af2761795428..ec6c4ca6d6d99 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -6112,7 +6112,8 @@ static int inet6_valid_dump_ifinfo(const struct nlmsghdr *nlh,
{
struct ifinfomsg *ifm;
- if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*ifm))) {
+ ifm = nlmsg_payload(nlh, sizeof(*ifm));
+ if (!ifm) {
NL_SET_ERR_MSG_MOD(extack, "Invalid header for link dump request");
return -EINVAL;
}
@@ -6122,7 +6123,6 @@ static int inet6_valid_dump_ifinfo(const struct nlmsghdr *nlh,
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_MOD(extack, "Invalid values in header for dump request");
--
2.47.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH net-next 2/8] ipv6: Use nlmsg_payload in addrconf file
2025-04-15 19:28 ` [PATCH net-next 2/8] ipv6: Use nlmsg_payload in addrconf file Breno Leitao
@ 2025-04-16 0:56 ` Kuniyuki Iwashima
0 siblings, 0 replies; 19+ messages in thread
From: Kuniyuki Iwashima @ 2025-04-16 0:56 UTC (permalink / raw)
To: leitao
Cc: andrew+netdev, davem, dsahern, edumazet, horms, kernel-team, kuba,
kuniyu, linux-kernel, netdev, pabeni
From: Breno Leitao <leitao@debian.org>
Date: Tue, 15 Apr 2025 12:28:53 -0700
> Leverage the new nlmsg_payload() helper to avoid checking for message
> size and then reading the nlmsg data.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net-next 3/8] ipv6: Use nlmsg_payload in route file
2025-04-15 19:28 [PATCH net-next 0/8] Adopting nlmsg_payload() in IPv4/IPv6 Breno Leitao
2025-04-15 19:28 ` [PATCH net-next 1/8] ipv6: Use nlmsg_payload in addrlabel file Breno Leitao
2025-04-15 19:28 ` [PATCH net-next 2/8] ipv6: Use nlmsg_payload in addrconf file Breno Leitao
@ 2025-04-15 19:28 ` Breno Leitao
2025-04-16 0:59 ` Kuniyuki Iwashima
2025-04-15 19:28 ` [PATCH net-next 4/8] ipv4: Use nlmsg_payload in devinet file Breno Leitao
` (5 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Breno Leitao @ 2025-04-15 19:28 UTC (permalink / raw)
To: kuniyu, David S. Miller, David Ahern, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn
Cc: netdev, linux-kernel, Breno Leitao, kernel-team
Leverage the new nlmsg_payload() helper to avoid checking for message
size and then reading the nlmsg data.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
net/ipv6/route.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 210b84cecc242..e2c6c0b0684b2 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -6029,7 +6029,8 @@ static int inet6_rtm_valid_getroute_req(struct sk_buff *skb,
struct rtmsg *rtm;
int i, err;
- if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*rtm))) {
+ rtm = nlmsg_payload(nlh, sizeof(*rtm));
+ if (!rtm) {
NL_SET_ERR_MSG_MOD(extack,
"Invalid header for get route request");
return -EINVAL;
@@ -6039,7 +6040,6 @@ static int inet6_rtm_valid_getroute_req(struct sk_buff *skb,
return nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX,
rtm_ipv6_policy, extack);
- rtm = nlmsg_data(nlh);
if ((rtm->rtm_src_len && rtm->rtm_src_len != 128) ||
(rtm->rtm_dst_len && rtm->rtm_dst_len != 128) ||
rtm->rtm_table || rtm->rtm_protocol || rtm->rtm_scope ||
--
2.47.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH net-next 3/8] ipv6: Use nlmsg_payload in route file
2025-04-15 19:28 ` [PATCH net-next 3/8] ipv6: Use nlmsg_payload in route file Breno Leitao
@ 2025-04-16 0:59 ` Kuniyuki Iwashima
0 siblings, 0 replies; 19+ messages in thread
From: Kuniyuki Iwashima @ 2025-04-16 0:59 UTC (permalink / raw)
To: leitao
Cc: andrew+netdev, davem, dsahern, edumazet, horms, kernel-team, kuba,
kuniyu, linux-kernel, netdev, pabeni
From: Breno Leitao <leitao@debian.org>
Date: Tue, 15 Apr 2025 12:28:54 -0700
> Leverage the new nlmsg_payload() helper to avoid checking for message
> size and then reading the nlmsg data.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net-next 4/8] ipv4: Use nlmsg_payload in devinet file
2025-04-15 19:28 [PATCH net-next 0/8] Adopting nlmsg_payload() in IPv4/IPv6 Breno Leitao
` (2 preceding siblings ...)
2025-04-15 19:28 ` [PATCH net-next 3/8] ipv6: Use nlmsg_payload in route file Breno Leitao
@ 2025-04-15 19:28 ` Breno Leitao
2025-04-16 1:00 ` Kuniyuki Iwashima
2025-04-15 19:28 ` [PATCH net-next 5/8] ipv4: Use nlmsg_payload in fib_frontend file Breno Leitao
` (4 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Breno Leitao @ 2025-04-15 19:28 UTC (permalink / raw)
To: kuniyu, David S. Miller, David Ahern, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn
Cc: netdev, linux-kernel, Breno Leitao, kernel-team
Leverage the new nlmsg_payload() helper to avoid checking for message
size and then reading the nlmsg data.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
net/ipv4/devinet.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 77e5705ac799e..c47d3828d4f65 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1792,12 +1792,12 @@ static int inet_valid_dump_ifaddr_req(const struct nlmsghdr *nlh,
struct ifaddrmsg *ifm;
int err, i;
- if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*ifm))) {
+ ifm = nlmsg_payload(nlh, sizeof(*ifm));
+ if (!ifm) {
NL_SET_ERR_MSG(extack, "ipv4: Invalid header for address dump request");
return -EINVAL;
}
- ifm = nlmsg_data(nlh);
if (ifm->ifa_prefixlen || ifm->ifa_flags || ifm->ifa_scope) {
NL_SET_ERR_MSG(extack, "ipv4: Invalid values in header for address dump request");
return -EINVAL;
--
2.47.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH net-next 4/8] ipv4: Use nlmsg_payload in devinet file
2025-04-15 19:28 ` [PATCH net-next 4/8] ipv4: Use nlmsg_payload in devinet file Breno Leitao
@ 2025-04-16 1:00 ` Kuniyuki Iwashima
0 siblings, 0 replies; 19+ messages in thread
From: Kuniyuki Iwashima @ 2025-04-16 1:00 UTC (permalink / raw)
To: leitao
Cc: andrew+netdev, davem, dsahern, edumazet, horms, kernel-team, kuba,
kuniyu, linux-kernel, netdev, pabeni
From: Breno Leitao <leitao@debian.org>
Date: Tue, 15 Apr 2025 12:28:55 -0700
> Leverage the new nlmsg_payload() helper to avoid checking for message
> size and then reading the nlmsg data.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net-next 5/8] ipv4: Use nlmsg_payload in fib_frontend file
2025-04-15 19:28 [PATCH net-next 0/8] Adopting nlmsg_payload() in IPv4/IPv6 Breno Leitao
` (3 preceding siblings ...)
2025-04-15 19:28 ` [PATCH net-next 4/8] ipv4: Use nlmsg_payload in devinet file Breno Leitao
@ 2025-04-15 19:28 ` Breno Leitao
2025-04-16 1:03 ` Kuniyuki Iwashima
2025-04-15 19:28 ` [PATCH net-next 6/8] ipv4: Use nlmsg_payload in route file Breno Leitao
` (3 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Breno Leitao @ 2025-04-15 19:28 UTC (permalink / raw)
To: kuniyu, David S. Miller, David Ahern, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn
Cc: netdev, linux-kernel, Breno Leitao, kernel-team
Leverage the new nlmsg_payload() helper to avoid checking for message
size and then reading the nlmsg data.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
net/ipv4/fib_frontend.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 3f4e629998fab..57f088e5540e2 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -948,12 +948,12 @@ int ip_valid_fib_dump_req(struct net *net, const struct nlmsghdr *nlh,
if (filter->rtnl_held)
ASSERT_RTNL();
- if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*rtm))) {
+ rtm = nlmsg_payload(nlh, sizeof(*rtm));
+ if (!rtm) {
NL_SET_ERR_MSG(extack, "Invalid header for FIB dump request");
return -EINVAL;
}
- rtm = nlmsg_data(nlh);
if (rtm->rtm_dst_len || rtm->rtm_src_len || rtm->rtm_tos ||
rtm->rtm_scope) {
NL_SET_ERR_MSG(extack, "Invalid values in header for FIB dump request");
--
2.47.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH net-next 5/8] ipv4: Use nlmsg_payload in fib_frontend file
2025-04-15 19:28 ` [PATCH net-next 5/8] ipv4: Use nlmsg_payload in fib_frontend file Breno Leitao
@ 2025-04-16 1:03 ` Kuniyuki Iwashima
0 siblings, 0 replies; 19+ messages in thread
From: Kuniyuki Iwashima @ 2025-04-16 1:03 UTC (permalink / raw)
To: leitao
Cc: andrew+netdev, davem, dsahern, edumazet, horms, kernel-team, kuba,
kuniyu, linux-kernel, netdev, pabeni
From: Breno Leitao <leitao@debian.org>
Date: Tue, 15 Apr 2025 12:28:56 -0700
> Leverage the new nlmsg_payload() helper to avoid checking for message
> size and then reading the nlmsg data.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net-next 6/8] ipv4: Use nlmsg_payload in route file
2025-04-15 19:28 [PATCH net-next 0/8] Adopting nlmsg_payload() in IPv4/IPv6 Breno Leitao
` (4 preceding siblings ...)
2025-04-15 19:28 ` [PATCH net-next 5/8] ipv4: Use nlmsg_payload in fib_frontend file Breno Leitao
@ 2025-04-15 19:28 ` Breno Leitao
2025-04-16 1:04 ` Kuniyuki Iwashima
2025-04-15 19:28 ` [PATCH net-next 7/8] ipv4: Use nlmsg_payload in ipmr file Breno Leitao
` (2 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Breno Leitao @ 2025-04-15 19:28 UTC (permalink / raw)
To: kuniyu, David S. Miller, David Ahern, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn
Cc: netdev, linux-kernel, Breno Leitao, kernel-team
Leverage the new nlmsg_payload() helper to avoid checking for message
size and then reading the nlmsg data.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
net/ipv4/route.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 22dfc971aab4b..49cffbe838029 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -3205,7 +3205,8 @@ static int inet_rtm_valid_getroute_req(struct sk_buff *skb,
struct rtmsg *rtm;
int i, err;
- if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*rtm))) {
+ rtm = nlmsg_payload(nlh, sizeof(*rtm));
+ if (!rtm) {
NL_SET_ERR_MSG(extack,
"ipv4: Invalid header for route get request");
return -EINVAL;
@@ -3215,7 +3216,6 @@ static int inet_rtm_valid_getroute_req(struct sk_buff *skb,
return nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX,
rtm_ipv4_policy, extack);
- rtm = nlmsg_data(nlh);
if ((rtm->rtm_src_len && rtm->rtm_src_len != 32) ||
(rtm->rtm_dst_len && rtm->rtm_dst_len != 32) ||
rtm->rtm_table || rtm->rtm_protocol ||
--
2.47.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH net-next 6/8] ipv4: Use nlmsg_payload in route file
2025-04-15 19:28 ` [PATCH net-next 6/8] ipv4: Use nlmsg_payload in route file Breno Leitao
@ 2025-04-16 1:04 ` Kuniyuki Iwashima
0 siblings, 0 replies; 19+ messages in thread
From: Kuniyuki Iwashima @ 2025-04-16 1:04 UTC (permalink / raw)
To: leitao
Cc: andrew+netdev, davem, dsahern, edumazet, horms, kernel-team, kuba,
kuniyu, linux-kernel, netdev, pabeni
From: Breno Leitao <leitao@debian.org>
Date: Tue, 15 Apr 2025 12:28:57 -0700
> Leverage the new nlmsg_payload() helper to avoid checking for message
> size and then reading the nlmsg data.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net-next 7/8] ipv4: Use nlmsg_payload in ipmr file
2025-04-15 19:28 [PATCH net-next 0/8] Adopting nlmsg_payload() in IPv4/IPv6 Breno Leitao
` (5 preceding siblings ...)
2025-04-15 19:28 ` [PATCH net-next 6/8] ipv4: Use nlmsg_payload in route file Breno Leitao
@ 2025-04-15 19:28 ` Breno Leitao
2025-04-16 1:06 ` Kuniyuki Iwashima
2025-04-15 19:28 ` [PATCH net-next 8/8] vxlan: Use nlmsg_payload in vxlan_vnifilter_dump Breno Leitao
2025-04-17 1:40 ` [PATCH net-next 0/8] Adopting nlmsg_payload() in IPv4/IPv6 patchwork-bot+netdevbpf
8 siblings, 1 reply; 19+ messages in thread
From: Breno Leitao @ 2025-04-15 19:28 UTC (permalink / raw)
To: kuniyu, David S. Miller, David Ahern, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn
Cc: netdev, linux-kernel, Breno Leitao, kernel-team
Leverage the new nlmsg_payload() helper to avoid checking for message
size and then reading the nlmsg data.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
net/ipv4/ipmr.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index a8b04d4abcaae..3b5677d8467ef 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -2511,7 +2511,8 @@ static int ipmr_rtm_valid_getroute_req(struct sk_buff *skb,
struct rtmsg *rtm;
int i, err;
- if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*rtm))) {
+ rtm = nlmsg_payload(nlh, sizeof(*rtm));
+ if (!rtm) {
NL_SET_ERR_MSG(extack, "ipv4: Invalid header for multicast route get request");
return -EINVAL;
}
@@ -2520,7 +2521,6 @@ static int ipmr_rtm_valid_getroute_req(struct sk_buff *skb,
return nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX,
rtm_ipv4_policy, extack);
- rtm = nlmsg_data(nlh);
if ((rtm->rtm_src_len && rtm->rtm_src_len != 32) ||
(rtm->rtm_dst_len && rtm->rtm_dst_len != 32) ||
rtm->rtm_tos || rtm->rtm_table || rtm->rtm_protocol ||
@@ -2836,7 +2836,8 @@ static int ipmr_valid_dumplink(const struct nlmsghdr *nlh,
{
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, "ipv4: Invalid header for ipmr link dump");
return -EINVAL;
}
@@ -2846,7 +2847,6 @@ static int ipmr_valid_dumplink(const struct nlmsghdr *nlh,
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 ipmr link dump request");
--
2.47.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH net-next 7/8] ipv4: Use nlmsg_payload in ipmr file
2025-04-15 19:28 ` [PATCH net-next 7/8] ipv4: Use nlmsg_payload in ipmr file Breno Leitao
@ 2025-04-16 1:06 ` Kuniyuki Iwashima
0 siblings, 0 replies; 19+ messages in thread
From: Kuniyuki Iwashima @ 2025-04-16 1:06 UTC (permalink / raw)
To: leitao
Cc: andrew+netdev, davem, dsahern, edumazet, horms, kernel-team, kuba,
kuniyu, linux-kernel, netdev, pabeni
From: Breno Leitao <leitao@debian.org>
Date: Tue, 15 Apr 2025 12:28:58 -0700
> Leverage the new nlmsg_payload() helper to avoid checking for message
> size and then reading the nlmsg data.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net-next 8/8] vxlan: Use nlmsg_payload in vxlan_vnifilter_dump
2025-04-15 19:28 [PATCH net-next 0/8] Adopting nlmsg_payload() in IPv4/IPv6 Breno Leitao
` (6 preceding siblings ...)
2025-04-15 19:28 ` [PATCH net-next 7/8] ipv4: Use nlmsg_payload in ipmr file Breno Leitao
@ 2025-04-15 19:28 ` Breno Leitao
2025-04-16 1:13 ` Kuniyuki Iwashima
2025-04-17 1:40 ` [PATCH net-next 0/8] Adopting nlmsg_payload() in IPv4/IPv6 patchwork-bot+netdevbpf
8 siblings, 1 reply; 19+ messages in thread
From: Breno Leitao @ 2025-04-15 19:28 UTC (permalink / raw)
To: kuniyu, David S. Miller, David Ahern, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn
Cc: netdev, linux-kernel, Breno Leitao, kernel-team
Leverage the new nlmsg_payload() helper to avoid checking for message
size and then reading the nlmsg data.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
drivers/net/vxlan/vxlan_vnifilter.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/vxlan/vxlan_vnifilter.c b/drivers/net/vxlan/vxlan_vnifilter.c
index 6e6e9f05509ab..d0753776d3394 100644
--- a/drivers/net/vxlan/vxlan_vnifilter.c
+++ b/drivers/net/vxlan/vxlan_vnifilter.c
@@ -411,13 +411,12 @@ static int vxlan_vnifilter_dump(struct sk_buff *skb, struct netlink_callback *cb
struct tunnel_msg *tmsg;
struct net_device *dev;
- if (cb->nlh->nlmsg_len < nlmsg_msg_size(sizeof(struct tunnel_msg))) {
+ tmsg = nlmsg_payload(cb->nlh, sizeof(*tmsg));
+ if (!tmsg) {
NL_SET_ERR_MSG(cb->extack, "Invalid msg length");
return -EINVAL;
}
- tmsg = nlmsg_data(cb->nlh);
-
if (tmsg->flags & ~TUNNEL_MSG_VALID_USER_FLAGS) {
NL_SET_ERR_MSG(cb->extack, "Invalid tunnelmsg flags in ancillary header");
return -EINVAL;
--
2.47.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH net-next 8/8] vxlan: Use nlmsg_payload in vxlan_vnifilter_dump
2025-04-15 19:28 ` [PATCH net-next 8/8] vxlan: Use nlmsg_payload in vxlan_vnifilter_dump Breno Leitao
@ 2025-04-16 1:13 ` Kuniyuki Iwashima
2025-04-16 13:55 ` Breno Leitao
0 siblings, 1 reply; 19+ messages in thread
From: Kuniyuki Iwashima @ 2025-04-16 1:13 UTC (permalink / raw)
To: leitao
Cc: andrew+netdev, davem, dsahern, edumazet, horms, kernel-team, kuba,
kuniyu, linux-kernel, netdev, pabeni
From: Breno Leitao <leitao@debian.org>
Date: Tue, 15 Apr 2025 12:28:59 -0700
> Leverage the new nlmsg_payload() helper to avoid checking for message
> size and then reading the nlmsg data.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Just grepped nlmsg_msg_size() and looks like the next series is last :)
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
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next 8/8] vxlan: Use nlmsg_payload in vxlan_vnifilter_dump
2025-04-16 1:13 ` Kuniyuki Iwashima
@ 2025-04-16 13:55 ` Breno Leitao
0 siblings, 0 replies; 19+ messages in thread
From: Breno Leitao @ 2025-04-16 13:55 UTC (permalink / raw)
To: Kuniyuki Iwashima
Cc: andrew+netdev, davem, dsahern, edumazet, horms, kernel-team, kuba,
linux-kernel, netdev, pabeni
Hello Kuniyuki,
On Tue, Apr 15, 2025 at 06:13:23PM -0700, Kuniyuki Iwashima wrote:
> From: Breno Leitao <leitao@debian.org>
> Date: Tue, 15 Apr 2025 12:28:59 -0700
> > Leverage the new nlmsg_payload() helper to avoid checking for message
> > size and then reading the nlmsg data.
> >
> > Signed-off-by: Breno Leitao <leitao@debian.org>
>
> Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
>
> Just grepped nlmsg_msg_size() and looks like the next series is last :)
>
> 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
Right, that matches my list as well.
Thanks for all this review,
--breno
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next 0/8] Adopting nlmsg_payload() in IPv4/IPv6
2025-04-15 19:28 [PATCH net-next 0/8] Adopting nlmsg_payload() in IPv4/IPv6 Breno Leitao
` (7 preceding siblings ...)
2025-04-15 19:28 ` [PATCH net-next 8/8] vxlan: Use nlmsg_payload in vxlan_vnifilter_dump Breno Leitao
@ 2025-04-17 1:40 ` patchwork-bot+netdevbpf
8 siblings, 0 replies; 19+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-17 1:40 UTC (permalink / raw)
To: Breno Leitao
Cc: kuniyu, davem, dsahern, edumazet, kuba, pabeni, horms,
andrew+netdev, netdev, linux-kernel, kernel-team
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 15 Apr 2025 12:28:51 -0700 you wrote:
> The commit 95d06e92a4019 ("netlink: Introduce nlmsg_payload helper")
> introduced the nlmsg_payload() helper function.
>
> This patchset aims to replace manual implementations with the
> nlmsg_payload() helper in IPv4 and IPv6 files, one file per patch.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
>
> [...]
Here is the summary with links:
- [net-next,1/8] ipv6: Use nlmsg_payload in addrlabel file
https://git.kernel.org/netdev/net-next/c/5ef4097ed155
- [net-next,2/8] ipv6: Use nlmsg_payload in addrconf file
https://git.kernel.org/netdev/net-next/c/6c454270a851
- [net-next,3/8] ipv6: Use nlmsg_payload in route file
https://git.kernel.org/netdev/net-next/c/bc05add844fc
- [net-next,4/8] ipv4: Use nlmsg_payload in devinet file
https://git.kernel.org/netdev/net-next/c/7d82cc229c09
- [net-next,5/8] ipv4: Use nlmsg_payload in fib_frontend file
https://git.kernel.org/netdev/net-next/c/b411638fb925
- [net-next,6/8] ipv4: Use nlmsg_payload in route file
https://git.kernel.org/netdev/net-next/c/d5ce0ed528c4
- [net-next,7/8] ipv4: Use nlmsg_payload in ipmr file
https://git.kernel.org/netdev/net-next/c/04e00a849e7c
- [net-next,8/8] vxlan: Use nlmsg_payload in vxlan_vnifilter_dump
https://git.kernel.org/netdev/net-next/c/9b1097a4108f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 19+ messages in thread