All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] xen: An error handling fix
@ 2025-03-14 14:34 Markus Armbruster
  2025-03-14 14:34 ` [PATCH 1/2] hw/xen: Fix xen_bus_realize() error handling Markus Armbruster
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Markus Armbruster @ 2025-03-14 14:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: sstabellini, anthony, paul, edgar.iglesias, xen-devel

Question to reviewers: should PATCH 2 downgrade to warning, to info,
or delete the report entirely?

Markus Armbruster (2):
  hw/xen: Fix xen_bus_realize() error handling
  hw/xen: Downgrade a xen_bus_realize() non-error to warning

 hw/xen/xen-bus.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
2.48.1



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

* [PATCH 1/2] hw/xen: Fix xen_bus_realize() error handling
  2025-03-14 14:34 [PATCH 0/2] xen: An error handling fix Markus Armbruster
@ 2025-03-14 14:34 ` Markus Armbruster
  2025-03-14 20:22   ` Stefano Stabellini
  2025-03-14 14:35 ` [PATCH 2/2] hw/xen: Downgrade a xen_bus_realize() non-error to warning Markus Armbruster
  2025-03-19  8:38 ` [PATCH 0/2] xen: An error handling fix Markus Armbruster
  2 siblings, 1 reply; 6+ messages in thread
From: Markus Armbruster @ 2025-03-14 14:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: sstabellini, anthony, paul, edgar.iglesias, xen-devel

The Error ** argument must be NULL, &error_abort, &error_fatal, or a
pointer to a variable containing NULL.  Passing an argument of the
latter kind twice without clearing it in between is wrong: if the
first call sets an error, it no longer points to NULL for the second
call.

xen_bus_realize() is wrong that way: it passes &local_err to
xs_node_watch() in a loop.  If this fails in more than one iteration,
it can trip error_setv()'s assertion.

Fix by clearing @local_err.

Fixes: c4583c8c394e (xen-bus: reduce scope of backend watch)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/xen/xen-bus.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c
index 8260f1e1bb..2aacc1436f 100644
--- a/hw/xen/xen-bus.c
+++ b/hw/xen/xen-bus.c
@@ -357,6 +357,7 @@ static void xen_bus_realize(BusState *bus, Error **errp)
             error_reportf_err(local_err,
                               "failed to set up '%s' enumeration watch: ",
                               type[i]);
+            local_err = NULL;
         }
 
         g_free(node);
-- 
2.48.1



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

* [PATCH 2/2] hw/xen: Downgrade a xen_bus_realize() non-error to warning
  2025-03-14 14:34 [PATCH 0/2] xen: An error handling fix Markus Armbruster
  2025-03-14 14:34 ` [PATCH 1/2] hw/xen: Fix xen_bus_realize() error handling Markus Armbruster
@ 2025-03-14 14:35 ` Markus Armbruster
  2025-03-14 20:22   ` Stefano Stabellini
  2025-03-19  8:38 ` [PATCH 0/2] xen: An error handling fix Markus Armbruster
  2 siblings, 1 reply; 6+ messages in thread
From: Markus Armbruster @ 2025-03-14 14:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: sstabellini, anthony, paul, edgar.iglesias, xen-devel

xen_bus_realize() reports a failure to set up a watch as error, but it
doesn't treat it as one: it simply continues.  Report a warning
instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/xen/xen-bus.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c
index 2aacc1436f..f808a01813 100644
--- a/hw/xen/xen-bus.c
+++ b/hw/xen/xen-bus.c
@@ -353,10 +353,9 @@ static void xen_bus_realize(BusState *bus, Error **errp)
             xs_node_watch(xenbus->xsh, node, key, xen_bus_backend_changed,
                           xenbus, &local_err);
         if (local_err) {
-            /* This need not be treated as a hard error so don't propagate */
-            error_reportf_err(local_err,
-                              "failed to set up '%s' enumeration watch: ",
-                              type[i]);
+            warn_reportf_err(local_err,
+                             "failed to set up '%s' enumeration watch: ",
+                             type[i]);
             local_err = NULL;
         }
 
-- 
2.48.1



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

* Re: [PATCH 1/2] hw/xen: Fix xen_bus_realize() error handling
  2025-03-14 14:34 ` [PATCH 1/2] hw/xen: Fix xen_bus_realize() error handling Markus Armbruster
@ 2025-03-14 20:22   ` Stefano Stabellini
  0 siblings, 0 replies; 6+ messages in thread
From: Stefano Stabellini @ 2025-03-14 20:22 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: qemu-devel, sstabellini, anthony, paul, edgar.iglesias, xen-devel

On Fri, 14 Mar 2025, Markus Armbruster wrote:
> The Error ** argument must be NULL, &error_abort, &error_fatal, or a
> pointer to a variable containing NULL.  Passing an argument of the
> latter kind twice without clearing it in between is wrong: if the
> first call sets an error, it no longer points to NULL for the second
> call.
> 
> xen_bus_realize() is wrong that way: it passes &local_err to
> xs_node_watch() in a loop.  If this fails in more than one iteration,
> it can trip error_setv()'s assertion.
> 
> Fix by clearing @local_err.
> 
> Fixes: c4583c8c394e (xen-bus: reduce scope of backend watch)
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  hw/xen/xen-bus.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c
> index 8260f1e1bb..2aacc1436f 100644
> --- a/hw/xen/xen-bus.c
> +++ b/hw/xen/xen-bus.c
> @@ -357,6 +357,7 @@ static void xen_bus_realize(BusState *bus, Error **errp)
>              error_reportf_err(local_err,
>                                "failed to set up '%s' enumeration watch: ",
>                                type[i]);
> +            local_err = NULL;
>          }
>  
>          g_free(node);
> -- 
> 2.48.1
> 


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

* Re: [PATCH 2/2] hw/xen: Downgrade a xen_bus_realize() non-error to warning
  2025-03-14 14:35 ` [PATCH 2/2] hw/xen: Downgrade a xen_bus_realize() non-error to warning Markus Armbruster
@ 2025-03-14 20:22   ` Stefano Stabellini
  0 siblings, 0 replies; 6+ messages in thread
From: Stefano Stabellini @ 2025-03-14 20:22 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: qemu-devel, sstabellini, anthony, paul, edgar.iglesias, xen-devel

On Fri, 14 Mar 2025, Markus Armbruster wrote:
> xen_bus_realize() reports a failure to set up a watch as error, but it
> doesn't treat it as one: it simply continues.  Report a warning
> instead.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  hw/xen/xen-bus.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c
> index 2aacc1436f..f808a01813 100644
> --- a/hw/xen/xen-bus.c
> +++ b/hw/xen/xen-bus.c
> @@ -353,10 +353,9 @@ static void xen_bus_realize(BusState *bus, Error **errp)
>              xs_node_watch(xenbus->xsh, node, key, xen_bus_backend_changed,
>                            xenbus, &local_err);
>          if (local_err) {
> -            /* This need not be treated as a hard error so don't propagate */
> -            error_reportf_err(local_err,
> -                              "failed to set up '%s' enumeration watch: ",
> -                              type[i]);
> +            warn_reportf_err(local_err,
> +                             "failed to set up '%s' enumeration watch: ",
> +                             type[i]);
>              local_err = NULL;
>          }
>  
> -- 
> 2.48.1
> 


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

* Re: [PATCH 0/2] xen: An error handling fix
  2025-03-14 14:34 [PATCH 0/2] xen: An error handling fix Markus Armbruster
  2025-03-14 14:34 ` [PATCH 1/2] hw/xen: Fix xen_bus_realize() error handling Markus Armbruster
  2025-03-14 14:35 ` [PATCH 2/2] hw/xen: Downgrade a xen_bus_realize() non-error to warning Markus Armbruster
@ 2025-03-19  8:38 ` Markus Armbruster
  2 siblings, 0 replies; 6+ messages in thread
From: Markus Armbruster @ 2025-03-19  8:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: sstabellini, anthony, paul, edgar.iglesias, xen-devel

Queued for 10.0.



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

end of thread, other threads:[~2025-03-19  8:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-14 14:34 [PATCH 0/2] xen: An error handling fix Markus Armbruster
2025-03-14 14:34 ` [PATCH 1/2] hw/xen: Fix xen_bus_realize() error handling Markus Armbruster
2025-03-14 20:22   ` Stefano Stabellini
2025-03-14 14:35 ` [PATCH 2/2] hw/xen: Downgrade a xen_bus_realize() non-error to warning Markus Armbruster
2025-03-14 20:22   ` Stefano Stabellini
2025-03-19  8:38 ` [PATCH 0/2] xen: An error handling fix Markus Armbruster

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.