[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240626194747.2561617-1-kuba@kernel.org>
Date: Wed, 26 Jun 2024 12:47:47 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org,
edumazet@...gle.com,
pabeni@...hat.com,
Jakub Kicinski <kuba@...nel.org>,
dsahern@...nel.org,
christoph.paasch@...ouvain.be
Subject: [PATCH net] tcp_metrics: validate source addr length
I don't see anything checking that TCP_METRICS_ATTR_SADDR_IPV4
is at least 4 bytes long, and the policy doesn't have an entry
for this attribute at all (neither does it for IPv6 but v6 is
manually validated).
Fixes: 8a59359cb80f ("tcp: metrics: New netlink attribute for src IP and dumped in netlink reply")
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
---
In net-next we can make v6 use policy for validation, too.
But it will conflict, so I'll send that on Thu.
---
CC: dsahern@...nel.org
CC: christoph.paasch@...ouvain.be
---
net/ipv4/tcp_metrics.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
index e93df98de3f4..b01eb6d94413 100644
--- a/net/ipv4/tcp_metrics.c
+++ b/net/ipv4/tcp_metrics.c
@@ -619,6 +619,7 @@ static const struct nla_policy tcp_metrics_nl_policy[TCP_METRICS_ATTR_MAX + 1] =
[TCP_METRICS_ATTR_ADDR_IPV4] = { .type = NLA_U32, },
[TCP_METRICS_ATTR_ADDR_IPV6] = { .type = NLA_BINARY,
.len = sizeof(struct in6_addr), },
+ [TCP_METRICS_ATTR_SADDR_IPV4] = { .type = NLA_U32, },
/* Following attributes are not received for GET/DEL,
* we keep them for reference
*/
--
2.45.2
Powered by blists - more mailing lists