xen: An error handling fix
cover xen: An error handling fix
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(-)
Signature · 1 line
2.48.1
PATCH 1/2 hw/xen: Fix xen_bus_realize() error handling
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.
--- hw/xen/xen-bus.c | 1 + 1 file changed, 1 insertion(+)
hw/xen/xen-bus.c +1 -0
@@ -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);
Signature · 1 line
2.48.1
Re: [PATCH 1/2] hw/xen: Fix xen_bus_realize() error handling
Quoted 6 lines · Markus Armbruster
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.
Quoted 8 lines
xen_bus_realize()is wrong that way: it passes&local_errtoxs_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 <[email protected]>
Quoted 19 lines
--- hw/xen/xen-bus.c | 1 + 1 file changed, 1 insertion(+)hw/xen/xen-bus.c +1
-0@@ -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);Signature · 1 line
2.48.1
PATCH 2/2 hw/xen: Downgrade a xen_bus_realize() non-error to warning
In reply to Markus Armbrusterxen_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.
--- hw/xen/xen-bus.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
hw/xen/xen-bus.c +3 -4
@@ -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 ; }
Signature · 1 line
2.48.1
Re: [PATCH 2/2] hw/xen: Downgrade a xen_bus_realize() non-error to warning
Quoted 5 lines · Markus Armbruster
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 <[email protected]>
Quoted 25 lines
--- hw/xen/xen-bus.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)hw/xen/xen-bus.c +3
-4@@ -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 ; }Signature · 1 line
2.48.1
Queued for 10.0.