diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2023-11-27 21:05:33 +0100 |
---|---|---|
committer | Martin KaFai Lau <martin.lau@kernel.org> | 2023-11-28 01:07:34 +0100 |
commit | 0bad281d0ecdf8391b0f42678b663336e7c3ceb0 (patch) | |
tree | d6a13a746e74f4a8f848216427f189e79b4db30c /drivers/net/netkit.c | |
parent | bpf: Add missed allocation hint for bpf_mem_cache_alloc_flags() (diff) | |
download | linux-0bad281d0ecdf8391b0f42678b663336e7c3ceb0.tar.xz linux-0bad281d0ecdf8391b0f42678b663336e7c3ceb0.zip |
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.
Fixes: 35dfaad7188c ("netkit, bpf: Add bpf programmable net device")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/e86a277a1e8d3b19890312779e42f790b0605ea4.1701115314.git.daniel@iogearbox.net
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'drivers/net/netkit.c')
-rw-r--r-- | drivers/net/netkit.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/netkit.c b/drivers/net/netkit.c index 97bd6705c241..39171380ccf2 100644 --- a/drivers/net/netkit.c +++ b/drivers/net/netkit.c @@ -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); |