netkit: Reject IFLA_NETKIT_PEER_INFO in netkit_change_link
Daniel Borkmann
maintainerPATCH v2 1/1 netkit: Reject IFLA_NETKIT_PEER_INFO in netkit_change_link
The IFLA_NETKIT_PEER_INFO attribute can only be used during device creation, but not via changelink callback. Hence reject it there.
---
v1 -> v2:
- Switch error code from EACCES to EINVAL (Jakub)
drivers/net/netkit.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/netkit.c +6 -0
@@ -851,6 +851,12 @@ static int netkit_change_link(struct net_device *dev, struct nlattr *tb[],return -EACCES ; } +if (data[IFLA_NETKIT_PEER_INFO ]) { +NL_SET_ERR_MSG_ATTR (extack, data[IFLA_NETKIT_PEER_INFO ], +"netkit peer info cannot be changed after device creation" ); +return -EINVAL ; + } +if (data[IFLA_NETKIT_POLICY ]) { attr = data[IFLA_NETKIT_POLICY ]; policy =nla_get_u32 (attr);
Signature · 1 line
2.21.0
Quoted 7 lines · On Mon, 27 Nov 2023 21:05:33 +0100 Daniel Borkmann wrote:
The
IFLA_NETKIT_PEER_INFOattribute can only be used during device creation, but not via changelink callback. Hence reject it there.Fixes 35dfaad7188c ("netkit, bpf: Add bpf programmable net device")Signed-off-by Daniel Borkmann <[email protected]>Cc Jakub Kicinski <[email protected]>
This patch was applied to bpf/bpf.git (master) by Martin KaFai Lau <[email protected]>:
Hello:
This patch was applied to bpf/bpf.git (master)
by Martin KaFai Lau <[email protected]>:
Quoted 9 lines · On Mon, 27 Nov 2023 21:05:33 +0100 you wrote:
The
IFLA_NETKIT_PEER_INFOattribute can only be used during device creation, but not via changelink callback. Hence reject it there.Fixes 35dfaad7188c ("netkit, bpf: Add bpf programmable net device")Signed-off-by Daniel Borkmann <[email protected]>Cc Jakub Kicinski <[email protected]>[...]
Here is the summary with links:
- [bpf,v2] netkit: Reject IFLA_NETKIT_PEER_INFO in netkit_change_link
https://git.kernel.org/bpf/bpf/c/0bad281d0ecd
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html