tcp_metrics: validate source addr length
Subsystems (3)
Jakub Kicinski
maintainerPATCH v2 1/1 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).
---
In net-next we can make v6 use policy for validation, too. But it will conflict, so I'll send that on Thu.
v2:
- fix the Fixes tag
v1: https://lore.kernel.org/all/[email protected]/
---
CC: [email protected]
CC: [email protected]
--- net/ipv4/tcp_metrics.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/tcp_metrics.c +1 -0
@@ -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 */
Signature · 1 line
2.45.2
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:
Quoted 10 lines · On Thu, 27 Jun 2024 14:25:00 -0700 you wrote:
I don't see anything checking that
TCP_METRICS_ATTR_SADDR_IPV4is 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).Reviewed-by Eric Dumazet <[email protected]>Fixes 3e7013ddf55a ("tcp: metrics: Allow selective get/del of tcp-metrics based on src IP")Signed-off-by Jakub Kicinski <[email protected]>[...]
Here is the summary with links:
- [net,v2] tcp_metrics: validate source addr length
https://git.kernel.org/netdev/net/c/66be40e622e1
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html