Skip to contentSkip to conversation

phonet: fix rtm_phonet_notify() skb allocation

PATCH Applied Eric Dumazet 3 participants 3 messages May 2, 2024 – May 7, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phonet: fix rtm_phonet_notify() skb allocation

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")
Cc Remi Denis-Courmont <[email protected]>
---
 net/phonet/pn_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/phonet/pn_netlink.c +1 -1
index 59aebe29689077bfa77d37516aea4617fe3b8a50..dd4c7e9a634fbe29645107de04a90688cdfb1a01 100644
@@ -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;
Signature · 1 line
2.45.0.rc0.197.gbae5840b3b-goog
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Le torstaina 2. toukokuuta 2024, 19.17.00 EEST Eric Dumazet a écrit :

fill_route() stores three components in the skb:

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

Therefore, rtm_phonet_notify() should use

Quoted 7 lines

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

Fixes f062f41d0657 ("Phonet: routing table Netlink interface")
Cc Remi Denis-Courmont <[email protected]>
Signature · 2 lines
Rémi Denis-Courmont
http://www.remlab.net/
#2 lore raw
In reply to Eric Dumazet
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Thu, 2 May 2024 16:17:00 +0000 you wrote:

fill_route() stores three components in the skb:

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

Therefore, rtm_phonet_notify() should use

[...]

Here is the summary with links:
- [net] phonet: fix rtm_phonet_notify() skb allocation

    https://git.kernel.org/netdev/net/c/d8cac8568618

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html