All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] of: overlay locking fixes
@ 2017-11-27 14:46 ` Geert Uytterhoeven
  0 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2017-11-27 14:46 UTC (permalink / raw)
  To: Pantelis Antoniou, Rob Herring, Frank Rowand
  Cc: devicetree, linux-kernel, Geert Uytterhoeven

	Hi Pantelis, Rob, Frank,

Here are two locking fixes for OF overlays, found by code inspection.

They were compile-tested only, as I'm still working on getting "real"
(configfs) overlays working again in v4.15-rc1...

Geert Uytterhoeven (2):
  of: overlay: Fix cleanup order in of_overlay_apply()
  of: unittest: Remove bogus overlay mutex release from
    overlay_data_add()

 drivers/of/overlay.c  | 6 +++---
 drivers/of/unittest.c | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)

-- 
2.7.4

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* [PATCH 0/2] of: overlay locking fixes
@ 2017-11-27 14:46 ` Geert Uytterhoeven
  0 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2017-11-27 14:46 UTC (permalink / raw)
  To: Pantelis Antoniou, Rob Herring, Frank Rowand
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven

	Hi Pantelis, Rob, Frank,

Here are two locking fixes for OF overlays, found by code inspection.

They were compile-tested only, as I'm still working on getting "real"
(configfs) overlays working again in v4.15-rc1...

Geert Uytterhoeven (2):
  of: overlay: Fix cleanup order in of_overlay_apply()
  of: unittest: Remove bogus overlay mutex release from
    overlay_data_add()

 drivers/of/overlay.c  | 6 +++---
 drivers/of/unittest.c | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)

-- 
2.7.4

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/2] of: overlay: Fix cleanup order in of_overlay_apply()
@ 2017-11-27 14:46   ` Geert Uytterhoeven
  0 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2017-11-27 14:46 UTC (permalink / raw)
  To: Pantelis Antoniou, Rob Herring, Frank Rowand
  Cc: devicetree, linux-kernel, Geert Uytterhoeven

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

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

* [PATCH 1/2] of: overlay: Fix cleanup order in of_overlay_apply()
@ 2017-11-27 14:46   ` Geert Uytterhoeven
  0 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2017-11-27 14:46 UTC (permalink / raw)
  To: Pantelis Antoniou, Rob Herring, Frank Rowand
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven

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-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/2] of: unittest: Remove bogus overlay mutex release from overlay_data_add()
@ 2017-11-27 14:46   ` Geert Uytterhoeven
  0 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2017-11-27 14:46 UTC (permalink / raw)
  To: Pantelis Antoniou, Rob Herring, Frank Rowand
  Cc: devicetree, linux-kernel, Geert Uytterhoeven

overlay_data_add() never takes the special overlay mutex, so it must not
be released in the error patch.

Presumably the call to of_overlay_mutex_unlock() is a relic from v1 of
the patch.

Fixes: f948d6d8b792bb90 ("of: overlay: avoid race condition between applying multiple overlays")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/of/unittest.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index e568b1e82501b832..0f8052f1355c0c09 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -2165,7 +2165,6 @@ static int __init overlay_data_add(int onum)
 	ret = of_overlay_apply(info->np_overlay, &info->overlay_id);
 	if (ret < 0) {
 		pr_err("of_overlay_apply() (ret=%d), %d\n", ret, onum);
-		of_overlay_mutex_unlock();
 		goto out_free_np_overlay;
 	}
 
-- 
2.7.4

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

* [PATCH 2/2] of: unittest: Remove bogus overlay mutex release from overlay_data_add()
@ 2017-11-27 14:46   ` Geert Uytterhoeven
  0 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2017-11-27 14:46 UTC (permalink / raw)
  To: Pantelis Antoniou, Rob Herring, Frank Rowand
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven

overlay_data_add() never takes the special overlay mutex, so it must not
be released in the error patch.

Presumably the call to of_overlay_mutex_unlock() is a relic from v1 of
the patch.

Fixes: f948d6d8b792bb90 ("of: overlay: avoid race condition between applying multiple overlays")
Signed-off-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
---
 drivers/of/unittest.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index e568b1e82501b832..0f8052f1355c0c09 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -2165,7 +2165,6 @@ static int __init overlay_data_add(int onum)
 	ret = of_overlay_apply(info->np_overlay, &info->overlay_id);
 	if (ret < 0) {
 		pr_err("of_overlay_apply() (ret=%d), %d\n", ret, onum);
-		of_overlay_mutex_unlock();
 		goto out_free_np_overlay;
 	}
 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 0/2] of: overlay locking fixes
  2017-11-27 14:46 ` Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  (?)
@ 2017-11-27 17:22 ` Frank Rowand
  -1 siblings, 0 replies; 11+ messages in thread
From: Frank Rowand @ 2017-11-27 17:22 UTC (permalink / raw)
  To: Geert Uytterhoeven, Pantelis Antoniou, Rob Herring
  Cc: devicetree, linux-kernel

Hi Geert,

I did not receive patch 1/2, can you please resend it?

-Frank

On 11/27/17 09:46, Geert Uytterhoeven wrote:
> 	Hi Pantelis, Rob, Frank,
> 
> Here are two locking fixes for OF overlays, found by code inspection.
> 
> They were compile-tested only, as I'm still working on getting "real"
> (configfs) overlays working again in v4.15-rc1...
> 
> Geert Uytterhoeven (2):
>   of: overlay: Fix cleanup order in of_overlay_apply()
>   of: unittest: Remove bogus overlay mutex release from
>     overlay_data_add()
> 
>  drivers/of/overlay.c  | 6 +++---
>  drivers/of/unittest.c | 1 -
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 

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

* Re: [PATCH 0/2] of: overlay locking fixes
@ 2017-11-27 17:49   ` Frank Rowand
  0 siblings, 0 replies; 11+ messages in thread
From: Frank Rowand @ 2017-11-27 17:49 UTC (permalink / raw)
  To: Geert Uytterhoeven, Pantelis Antoniou, Rob Herring
  Cc: devicetree, linux-kernel

On 11/27/17 09:46, Geert Uytterhoeven wrote:
> 	Hi Pantelis, Rob, Frank,
> 
> Here are two locking fixes for OF overlays, found by code inspection.
> 
> They were compile-tested only, as I'm still working on getting "real"
> (configfs) overlays working again in v4.15-rc1...
> 
> Geert Uytterhoeven (2):
>   of: overlay: Fix cleanup order in of_overlay_apply()
>   of: unittest: Remove bogus overlay mutex release from
>     overlay_data_add()
> 
>  drivers/of/overlay.c  | 6 +++---
>  drivers/of/unittest.c | 1 -
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 

All patches:

Reviewed-by: Frank Rowand <frank.rowand@sony.com>

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

* Re: [PATCH 0/2] of: overlay locking fixes
@ 2017-11-27 17:49   ` Frank Rowand
  0 siblings, 0 replies; 11+ messages in thread
From: Frank Rowand @ 2017-11-27 17:49 UTC (permalink / raw)
  To: Geert Uytterhoeven, Pantelis Antoniou, Rob Herring
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA

On 11/27/17 09:46, Geert Uytterhoeven wrote:
> 	Hi Pantelis, Rob, Frank,
> 
> Here are two locking fixes for OF overlays, found by code inspection.
> 
> They were compile-tested only, as I'm still working on getting "real"
> (configfs) overlays working again in v4.15-rc1...
> 
> Geert Uytterhoeven (2):
>   of: overlay: Fix cleanup order in of_overlay_apply()
>   of: unittest: Remove bogus overlay mutex release from
>     overlay_data_add()
> 
>  drivers/of/overlay.c  | 6 +++---
>  drivers/of/unittest.c | 1 -
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 

All patches:

Reviewed-by: Frank Rowand <frank.rowand-7U/KSKJipcs@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 0/2] of: overlay locking fixes
@ 2017-11-28 14:59   ` Rob Herring
  0 siblings, 0 replies; 11+ messages in thread
From: Rob Herring @ 2017-11-28 14:59 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Pantelis Antoniou, Frank Rowand, devicetree, linux-kernel

On Mon, Nov 27, 2017 at 03:46:25PM +0100, Geert Uytterhoeven wrote:
> 	Hi Pantelis, Rob, Frank,
> 
> Here are two locking fixes for OF overlays, found by code inspection.
> 
> They were compile-tested only, as I'm still working on getting "real"
> (configfs) overlays working again in v4.15-rc1...
> 
> Geert Uytterhoeven (2):
>   of: overlay: Fix cleanup order in of_overlay_apply()
>   of: unittest: Remove bogus overlay mutex release from
>     overlay_data_add()

Applied.

Rob

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

* Re: [PATCH 0/2] of: overlay locking fixes
@ 2017-11-28 14:59   ` Rob Herring
  0 siblings, 0 replies; 11+ messages in thread
From: Rob Herring @ 2017-11-28 14:59 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Pantelis Antoniou, Frank Rowand,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Mon, Nov 27, 2017 at 03:46:25PM +0100, Geert Uytterhoeven wrote:
> 	Hi Pantelis, Rob, Frank,
> 
> Here are two locking fixes for OF overlays, found by code inspection.
> 
> They were compile-tested only, as I'm still working on getting "real"
> (configfs) overlays working again in v4.15-rc1...
> 
> Geert Uytterhoeven (2):
>   of: overlay: Fix cleanup order in of_overlay_apply()
>   of: unittest: Remove bogus overlay mutex release from
>     overlay_data_add()

Applied.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2017-11-28 14:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-27 14:46 [PATCH 0/2] of: overlay locking fixes Geert Uytterhoeven
2017-11-27 14:46 ` Geert Uytterhoeven
2017-11-27 14:46 ` [PATCH 1/2] of: overlay: Fix cleanup order in of_overlay_apply() Geert Uytterhoeven
2017-11-27 14:46   ` Geert Uytterhoeven
2017-11-27 14:46 ` [PATCH 2/2] of: unittest: Remove bogus overlay mutex release from overlay_data_add() Geert Uytterhoeven
2017-11-27 14:46   ` Geert Uytterhoeven
2017-11-27 17:22 ` [PATCH 0/2] of: overlay locking fixes Frank Rowand
2017-11-27 17:49 ` Frank Rowand
2017-11-27 17:49   ` Frank Rowand
2017-11-28 14:59 ` Rob Herring
2017-11-28 14:59   ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.