Thread (4 messages) read the whole thread 4 messages, 3 authors, 2023-11-27

Re: [PATCH bpf] netkit: Reject IFLA_NETKIT_PEER_INFO in netkit_change_link

From: Nikolay Aleksandrov <razor@blackwall.org>
Date: 2023-11-27 13:47:04
Also in: bpf

On 11/27/23 15:43, Daniel Borkmann wrote:
quoted hunk ↗ jump to hunk
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>
---
  drivers/net/netkit.c | 6 ++++++
  1 file changed, 6 insertions(+)
diff --git a/drivers/net/netkit.c b/drivers/net/netkit.c
index 97bd6705c241..35553b16b8e2 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 -EACCES;
+	}
+
  	if (data[IFLA_NETKIT_POLICY]) {
  		attr = data[IFLA_NETKIT_POLICY];
  		policy = nla_get_u32(attr);
Good catch,
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help