diff mbox series

[net] phonet: fix rtm_phonet_notify() skb allocation

Message ID 20240502161700.1804476-1-edumazet@google.com (mailing list archive)
State Accepted
Commit d8cac8568618dcb8a51af3db1103e8d4cc4aeea7
Delegated to: Netdev Maintainers
Headers show
Series [net] phonet: fix rtm_phonet_notify() skb allocation | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 926 this patch: 926
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 5 of 6 maintainers
netdev/build_clang success Errors and warnings before: 937 this patch: 937
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 937 this patch: 937
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-05-05--03-00 (tests: 1003)

Commit Message

Eric Dumazet May 2, 2024, 4:17 p.m. UTC
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>
Cc: Remi Denis-Courmont <courmisch@gmail.com>
---
 net/phonet/pn_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rémi Denis-Courmont May 2, 2024, 5:34 p.m. UTC | #1
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
> 
> 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>
> Cc: Remi Denis-Courmont <courmisch@gmail.com>

Acked-by: Rémi Denis-Courmont <courmisch@gmail.com>
patchwork-bot+netdevbpf@kernel.org May 7, 2024, 2 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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!
diff mbox series

Patch

diff --git a/net/phonet/pn_netlink.c b/net/phonet/pn_netlink.c
index 59aebe29689077bfa77d37516aea4617fe3b8a50..dd4c7e9a634fbe29645107de04a90688cdfb1a01 100644
--- a/net/phonet/pn_netlink.c
+++ b/net/phonet/pn_netlink.c
@@ -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;