]> git.dujemihanovic.xyz Git - linux.git/commitdiff
phonet: fix rtm_phonet_notify() skb allocation
authorEric Dumazet <edumazet@google.com>
Thu, 2 May 2024 16:17:00 +0000 (16:17 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 7 May 2024 01:30:00 +0000 (18:30 -0700)
fill_route() stores three components in the skb:

- struct rtmsg
- RTA_DST (u8)
- RTA_OIF (u32)

Therefore, rtm_phonet_notify() should use

NLMSG_ALIGN(sizeof(struct rtmsg)) +
nla_total_size(1) +
nla_total_size(4)

Fixes: f062f41d0657 ("Phonet: routing table Netlink interface")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: RĂ©mi Denis-Courmont <courmisch@gmail.com>
Link: https://lore.kernel.org/r/20240502161700.1804476-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/phonet/pn_netlink.c

index 59aebe29689077bfa77d37516aea4617fe3b8a50..dd4c7e9a634fbe29645107de04a90688cdfb1a01 100644 (file)
@@ -193,7 +193,7 @@ void rtm_phonet_notify(int event, struct net_device *dev, u8 dst)
        struct sk_buff *skb;
        int err = -ENOBUFS;
 
-       skb = nlmsg_new(NLMSG_ALIGN(sizeof(struct ifaddrmsg)) +
+       skb = nlmsg_new(NLMSG_ALIGN(sizeof(struct rtmsg)) +
                        nla_total_size(1) + nla_total_size(4), GFP_KERNEL);
        if (skb == NULL)
                goto errout;