From: Breno Leitao <leitao@debian.org>
To: kuniyu@amazon.com, "David S. Miller" <davem@davemloft.net>,
David Ahern <dsahern@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Breno Leitao <leitao@debian.org>,
kernel-team@meta.com
Subject: [PATCH net-next 2/8] ipv6: Use nlmsg_payload in addrconf file
Date: Tue, 15 Apr 2025 12:28:53 -0700 [thread overview]
Message-ID: <20250415-nlmsg_v2-v1-2-a1c75d493fd7@debian.org> (raw)
In-Reply-To: <20250415-nlmsg_v2-v1-0-a1c75d493fd7@debian.org>
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
next prev parent reply other threads:[~2025-04-15 19:29 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
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-16 0:54 ` Kuniyuki Iwashima
2025-04-15 19:28 ` Breno Leitao [this message]
2025-04-16 0:56 ` [PATCH net-next 2/8] ipv6: Use nlmsg_payload in addrconf file Kuniyuki Iwashima
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
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
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
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
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
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
2025-04-17 1:40 ` [PATCH net-next 0/8] Adopting nlmsg_payload() in IPv4/IPv6 patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250415-nlmsg_v2-v1-2-a1c75d493fd7@debian.org \
--to=leitao@debian.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.