Skip to contentSkip to conversation

dmaengine: ti: k3-psil: fix deadlock on error path

PATCH Applied Grygorii Strashko 3 participants 3 messages Apr 8, 2020 – Apr 15, 2020

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

PATCH 1/1 dmaengine: ti: k3-psil: fix deadlock on error path

The mutex_unlock() is missed on error path of psil_get_ep_config() which causes deadlock, so add missed mutex_unlock().

Fixes 8c6bb62f6b4a ("dmaengine: ti: k3 PSI-L remote endpoint configuration")
---
 drivers/dma/ti/k3-psil.c | 1 +
 1 file changed, 1 insertion(+)
drivers/dma/ti/k3-psil.c +1 -0
index d7b965049ccb..fb7c8150b0d1 100644
@@ -27,6 +27,7 @@ struct psil_endpoint_config *psil_get_ep_config(u32 thread_id)
 			soc_ep_map = &j721e_ep_map;
 		} else {
 			pr_err("PSIL: No compatible machine found for map\n");
+			mutex_unlock(&ep_map_mutex);
 			return ERR_PTR(-ENOTSUPP);
 		}
 		pr_debug("%s: Using map for %s\n", __func__, soc_ep_map->name);
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Grygorii Strashko

The mutex_unlock() is missed on error path of psil_get_ep_config() which causes deadlock, so add missed mutex_unlock().

Ah, you are right, thanks for catching it!

Quoted 12 lines
Fixes 8c6bb62f6b4a ("dmaengine: ti: k3 PSI-L remote endpoint configuration")
---
 drivers/dma/ti/k3-psil.c | 1 +
 1 file changed, 1 insertion(+)
drivers/dma/ti/k3-psil.c +0 -0
index d7b965049ccb..fb7c8150b0d1 100644

drivers/dma/ti/k3-psil.c struct psil_endpoint_config *psil_get_ep_config(u32 thread_id) · line 33

Quoted 7 lines
drivers/dma/ti/k3-psil.c +1 -0
@@ -27,6 +27,7 @@ struct psil_endpoint_config *psil_get_ep_config(u32 thread_id)
 			soc_ep_map = &j721e_ep_map;
 		} else {
 			pr_err("PSIL: No compatible machine found for map\n");
+			mutex_unlock(&ep_map_mutex);
 			return ERR_PTR(-ENOTSUPP);
 		}
 		pr_debug("%s: Using map for %s\n", __func__, soc_ep_map->name);

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

maintainer Applied
#2 lore raw
In reply to Grygorii Strashko
Quoted 2 lines · Grygorii Strashko

The mutex_unlock() is missed on error path of psil_get_ep_config() which causes deadlock, so add missed mutex_unlock().

Applied, thanks

Signature · 1 line
~Vinod