summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2024-06-27 14:25:00 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-07-11 12:47:11 +0200
commit31f03bb04146c1c6df6c03e9f45401f5f5a985d3 (patch)
tree67aee49f98e3768d835d204f96284221d4ab109d /net
parentf8b7bd500d89a401167d85dbe78882fbabc7d2ad (diff)
downloadlinux-31f03bb04146c1c6df6c03e9f45401f5f5a985d3.tar.gz
linux-31f03bb04146c1c6df6c03e9f45401f5f5a985d3.tar.bz2
linux-31f03bb04146c1c6df6c03e9f45401f5f5a985d3.zip
tcp_metrics: validate source addr length
[ Upstream commit 66be40e622e177316ae81717aa30057ba9e61dff ] 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). Reviewed-by: Eric Dumazet <edumazet@google.com> Fixes: 3e7013ddf55a ("tcp: metrics: Allow selective get/del of tcp-metrics based on src IP") Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp_metrics.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
index a7364ff8b558..a4e03a7a2c03 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
*/