Skip to content

Commit

Permalink
phonet: fix rtm_phonet_notify() skb allocation
Browse files Browse the repository at this point in the history
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: f062f41 ("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>
  • Loading branch information
Eric Dumazet authored and kuba-moo committed May 7, 2024
1 parent a26ff37 commit d8cac85
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/phonet/pn_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d8cac85

Please sign in to comment.