[PATCH 1/2] of: overlay: Fix cleanup order in of_overlay_apply()
From: Geert Uytterhoeven
Date: Mon Nov 27 2017 - 09:46:56 EST
The special overlay mutex is taken first, hence it should be released
last in the error path.
Fixes: f948d6d8b792bb90 ("of: overlay: avoid race condition between applying multiple overlays")
Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
---
drivers/of/overlay.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index c150abb9049d776d..3b7a3980ff50d6bf 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -760,14 +760,14 @@ int of_overlay_apply(struct device_node *tree, int *ovcs_id)
goto out;
-err_overlay_unlock:
- of_overlay_mutex_unlock();
-
err_free_overlay_changeset:
free_overlay_changeset(ovcs);
mutex_unlock(&of_mutex);
+err_overlay_unlock:
+ of_overlay_mutex_unlock();
+
out:
pr_debug("%s() err=%d\n", __func__, ret);
--
2.7.4