[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241219132644.725161-1-yuyanghuang@google.com>
Date: Thu, 19 Dec 2024 22:26:44 +0900
From: Yuyang Huang <yuyanghuang@...gle.com>
To: Yuyang Huang <yuyanghuang@...gle.com>
Cc: "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
David Ahern <dsahern@...nel.org>, roopa@...ulusnetworks.com, jiri@...nulli.us,
stephen@...workplumber.org, jimictw@...gle.com, prohr@...gle.com,
liuhangbin@...il.com, nicolas.dichtel@...nd.com, andrew@...n.ch,
pruddy@...tta.att-mail.com, netdev@...r.kernel.org,
"Maciej Żenczykowski" <maze@...gle.com>, Lorenzo Colitti <lorenzo@...gle.com>
Subject: [PATCH net-next] netlink: correct nlmsg size for multicast notifications
Corrected the netlink message size calculation for multicast group
join/leave notifications. The previous calculation did not account for
the inclusion of both IPv4/IPv6 addresses and ifa_cacheinfo in the
payload. This fix ensures that the allocated message size is
sufficient to hold all necessary information.
Fixes: 2c2b61d2138f ("netlink: add IGMP/MLD join/leave notifications")
Cc: Maciej Żenczykowski <maze@...gle.com>
Cc: Lorenzo Colitti <lorenzo@...gle.com>
Signed-off-by: Yuyang Huang <yuyanghuang@...gle.com>
---
net/ipv4/igmp.c | 4 +++-
net/ipv6/mcast.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 8a370ef37d3f..4e2f1497f320 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1473,7 +1473,9 @@ static void inet_ifmcaddr_notify(struct net_device *dev,
int err = -ENOMEM;
skb = nlmsg_new(NLMSG_ALIGN(sizeof(struct ifaddrmsg)) +
- nla_total_size(sizeof(__be32)), GFP_ATOMIC);
+ nla_total_size(sizeof(__be32)) +
+ nla_total_size(sizeof(struct ifa_cacheinfo)),
+ GFP_ATOMIC);
if (!skb)
goto error;
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 587831c148de..b7430f15d1fc 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -920,7 +920,9 @@ static void inet6_ifmcaddr_notify(struct net_device *dev,
int err = -ENOMEM;
skb = nlmsg_new(NLMSG_ALIGN(sizeof(struct ifaddrmsg)) +
- nla_total_size(16), GFP_ATOMIC);
+ nla_total_size(16) +
+ nla_total_size(sizeof(struct ifa_cacheinfo)),
+ GFP_ATOMIC);
if (!skb)
goto error;
--
2.47.1.613.gc27f4b7a9f-goog
Powered by blists - more mailing lists