mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-15 08:36:43 +07:00
bridge: mrp: Validate when setting the port role
This patch adds specific checks for primary(0x0) and secondary(0x1) when
setting the port role. For any other value the function
'br_mrp_set_port_role' will return -EINVAL.
Fixes: 20f6a05ef6
("bridge: mrp: Rework the MRP netlink interface")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2464bc7c28
commit
7882c895b7
@ -411,10 +411,16 @@ int br_mrp_set_port_role(struct net_bridge_port *p,
|
||||
if (!mrp)
|
||||
return -EINVAL;
|
||||
|
||||
if (role == BR_MRP_PORT_ROLE_PRIMARY)
|
||||
switch (role) {
|
||||
case BR_MRP_PORT_ROLE_PRIMARY:
|
||||
rcu_assign_pointer(mrp->p_port, p);
|
||||
else
|
||||
break;
|
||||
case BR_MRP_PORT_ROLE_SECONDARY:
|
||||
rcu_assign_pointer(mrp->s_port, p);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
br_mrp_port_switchdev_set_role(p, role);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user