netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: dsa: ocelot: unlock on error in vsc9959_qos_port_tas_set()
@ 2023-06-06  8:24 Dan Carpenter
  2023-06-06  9:04 ` Vladimir Oltean
  2023-06-07  9:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2023-06-06  8:24 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: Claudiu Manoil, Alexandre Belloni, UNGLinuxDriver, Andrew Lunn,
	Florian Fainelli, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Muhammad Husaini Zulkifli, Kurt Kanzenbach,
	Gerhard Engleder, netdev, kernel-janitors

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")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/net/dsa/ocelot/felix_vsc9959.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
index 5de6a27052fc..903532ea9fa4 100644
--- a/drivers/net/dsa/ocelot/felix_vsc9959.c
+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
@@ -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);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: dsa: ocelot: unlock on error in vsc9959_qos_port_tas_set()
  2023-06-06  8:24 [PATCH net-next] net: dsa: ocelot: unlock on error in vsc9959_qos_port_tas_set() Dan Carpenter
@ 2023-06-06  9:04 ` Vladimir Oltean
  2023-06-07  9:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Oltean @ 2023-06-06  9:04 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Claudiu Manoil, Alexandre Belloni, UNGLinuxDriver, Andrew Lunn,
	Florian Fainelli, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Muhammad Husaini Zulkifli, Kurt Kanzenbach,
	Gerhard Engleder, netdev, kernel-janitors

On Tue, Jun 06, 2023 at 11:24:37AM +0300, Dan Carpenter 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---

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.

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>

>  drivers/net/dsa/ocelot/felix_vsc9959.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
> index 5de6a27052fc..903532ea9fa4 100644
> --- a/drivers/net/dsa/ocelot/felix_vsc9959.c
> +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
> @@ -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);
> -- 
> 2.39.2
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: dsa: ocelot: unlock on error in vsc9959_qos_port_tas_set()
  2023-06-06  8:24 [PATCH net-next] net: dsa: ocelot: unlock on error in vsc9959_qos_port_tas_set() Dan Carpenter
  2023-06-06  9:04 ` Vladimir Oltean
@ 2023-06-07  9:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-06-07  9:20 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: vladimir.oltean, claudiu.manoil, alexandre.belloni,
	UNGLinuxDriver, andrew, f.fainelli, davem, edumazet, kuba, pabeni,
	muhammad.husaini.zulkifli, kurt, gerhard, netdev, kernel-janitors

Hello:

This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

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")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-07  9:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-06  8:24 [PATCH net-next] net: dsa: ocelot: unlock on error in vsc9959_qos_port_tas_set() Dan Carpenter
2023-06-06  9:04 ` Vladimir Oltean
2023-06-07  9:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).