amt: fix size calculation in amt_get_size()
Subsystems (3)
PATCH 1/1 amt: fix size calculation in amt_get_size()
amt_get_size() incorrectly used sizeof(struct iphdr) for the sizes of IFLA_AMT_DISCOVERY_IP, IFLA_AMT_REMOTE_IP, and IFLA_AMT_LOCAL_IP. These attributes contain IPv4 addresses (__be32), not full IP headers.
Replace sizeof(struct iphdr) with sizeof(__be32) to avoid over-allocating netlink message space.
--- drivers/net/amt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/amt.c +3 -3
@@ -3301,9 +3301,9 @@ static size_t amt_get_size(const struct net_device *dev)nla_total_size (sizeof (__u16)) +/* IFLA_AMT_GATEWAY_PORT */ nla_total_size (sizeof (__u32)) +/* IFLA_AMT_LINK */ nla_total_size (sizeof (__u32)) +/* IFLA_MAX_TUNNELS */ -nla_total_size (sizeof (struct iphdr )) +/* IFLA_AMT_DISCOVERY_IP */ -nla_total_size (sizeof (struct iphdr )) +/* IFLA_AMT_REMOTE_IP */ -nla_total_size (sizeof (struct iphdr ));/* IFLA_AMT_LOCAL_IP */ +nla_total_size (sizeof (__be32)) +/* IFLA_AMT_DISCOVERY_IP */ +nla_total_size (sizeof (__be32)) +/* IFLA_AMT_REMOTE_IP */ +nla_total_size (sizeof (__be32));/* IFLA_AMT_LOCAL_IP */ }static int amt_fill_info (struct sk_buff *skb,const struct net_device *dev)
Signature · 1 line
2.55.0.rc0.799.gd6f94ed593-goog
Quoted 10 lines · Eric Dumazet
amt_get_size()incorrectly used sizeof(struct iphdr) for the sizes ofIFLA_AMT_DISCOVERY_IP,IFLA_AMT_REMOTE_IP, andIFLA_AMT_LOCAL_IP. These attributes contain IPv4 addresses (__be32), not full IP headers.Replace sizeof(struct iphdr) with
sizeof(__be32)to avoid over-allocating netlink message space.Fixes b9022b53adad ("amt: add control plane of amt interface")Signed-off-by Eric Dumazet <[email protected]>
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 8 lines · On Wed, 1 Jul 2026 12:23:29 +0000 you wrote:
amt_get_size()incorrectly used sizeof(struct iphdr) for the sizes ofIFLA_AMT_DISCOVERY_IP,IFLA_AMT_REMOTE_IP, andIFLA_AMT_LOCAL_IP. These attributes contain IPv4 addresses (__be32), not full IP headers.Replace sizeof(struct iphdr) with
sizeof(__be32)to avoid over-allocating netlink message space.[...]
Here is the summary with links:
- [net] amt: fix size calculation in amt_get_size()
https://git.kernel.org/netdev/net/c/9e05e91a9a84
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html