Skip to contentSkip to conversation

net: dsa: ocelot: unlock on error in vsc9959_qos_port_tas_set()

PATCH Applied Dan Carpenter 3 participants 3 messages Jun 6, 2023 – Jun 7, 2023

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dsa: ocelot: unlock on error in vsc9959_qos_port_tas_set()

This error path needs call mutex_unlock(&ocelot->tas_lock) before returning.

Fixes 2d800bc500fb ("net/sched: taprio: replace tc_taprio_qopt_offload :: enable with a "cmd" enum")
---
 drivers/net/dsa/ocelot/felix_vsc9959.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/dsa/ocelot/felix_vsc9959.c +2 -1
index 5de6a27052fc..903532ea9fa4 100644
@@ -1424,7 +1424,8 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port,
 		mutex_unlock(&ocelot->tas_lock);
 		return 0;
 	} else if (taprio->cmd != TAPRIO_CMD_REPLACE) {
-		return -EOPNOTSUPP;
+		ret = -EOPNOTSUPP;
+		goto err_unlock;
 	}
 
 	ret = ocelot_port_mqprio(ocelot, port, &taprio->mqprio);
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Dan Carpenter

This error path needs call mutex_unlock(&ocelot->tas_lock) before returning.

Fixes 2d800bc500fb ("net/sched: taprio: replace tc_taprio_qopt_offload :: enable with a "cmd" enum")

---

Thanks. I had a slightly different patch which only locked the mutex in the first place if the taprio->cmd was known at all (there's nothing to serialize otherwise), but I didn't send it in time to resolve the issue, so yours will have to do as well.

Quoted 20 lines
 drivers/net/dsa/ocelot/felix_vsc9959.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/dsa/ocelot/felix_vsc9959.c +2 -1
index 5de6a27052fc..903532ea9fa4 100644
@@ -1424,7 +1424,8 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port,
 		mutex_unlock(&ocelot->tas_lock);
 		return 0;
 	} else if (taprio->cmd != TAPRIO_CMD_REPLACE) {
-		return -EOPNOTSUPP;
+		ret = -EOPNOTSUPP;
+		goto err_unlock;
 	}
 
 	ret = ocelot_port_mqprio(ocelot, port, &taprio->mqprio);
Signature · 1 line
2.39.2
#2 lore raw
In reply to Dan Carpenter
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Quoted 8 lines · On Tue, 6 Jun 2023 11:24:37 +0300 you wrote:

This error path needs call mutex_unlock(&ocelot->tas_lock) before returning.

Fixes 2d800bc500fb ("net/sched: taprio: replace tc_taprio_qopt_offload :: enable with a "cmd" enum")
---
 drivers/net/dsa/ocelot/felix_vsc9959.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Here is the summary with links:
- [net-next] net: dsa: ocelot: unlock on error in vsc9959_qos_port_tas_set()

    https://git.kernel.org/netdev/net-next/c/cad7526f33ce

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html