lkml.org 
[lkml]   [2017]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] of: overlay: Fix cleanup order in of_overlay_apply()
Date
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@glider.be>
---
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
\
 
 \ /
  Last update: 2017-11-27 15:47    [W:0.061 / U:9.976 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site