[PATCH net-next 09/13] net: dsa: lantiq_gswip: Forbid gswip_add_single_port_br on the CPU port
From: Martin Schiller
Date: Thu Jun 06 2024 - 04:59:18 EST
From: Martin Blumenstingl <martin.blumenstingl@xxxxxxxxxxxxxx>
Calling gswip_add_single_port_br() with the CPU port would be a bug
because then only the CPU port could talk to itself. Add the CPU port to
the validation at the beginning of gswip_add_single_port_br().
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@xxxxxxxxxxxxxx>
---
drivers/net/dsa/lantiq_gswip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
index ee8296d5b901..d2195271ffe9 100644
--- a/drivers/net/dsa/lantiq_gswip.c
+++ b/drivers/net/dsa/lantiq_gswip.c
@@ -657,7 +657,7 @@ static int gswip_add_single_port_br(struct gswip_priv *priv, int port, bool add)
unsigned int max_ports = priv->hw_info->max_ports;
int err;
- if (port >= max_ports) {
+ if (port >= max_ports || dsa_is_cpu_port(priv->ds, port)) {
dev_err(priv->dev, "single port for %i supported\n", port);
return -EIO;
}
--
2.39.2