Skip to contentSkip to conversation

libxl: Fix error path in libxl_device_events_handler

PATCH In review Ian Jackson 2 participants 5 messages Feb 19, 2014 – May 22, 2014 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/2 libxl: Fix error path in libxl_device_events_handler

libxl_device_events_handler would fail to call AO_ABORT if it failed; instead it would simply return rc. (This leaves the egc etc. from the now-abolished stack frame potentially live, and leaves the ctx locked.)

In xl, this is of no consequence, because xl will immediately exit in this situation. This is very likely to be true in any other callers (of which we don't know of any, anyway).

Coverity-ID: 1181840

---
 tools/libxl/libxl.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/libxl/libxl.c +2 -1
index 730f6e1..2d29ad2 100644
@@ -3881,7 +3881,8 @@ int libxl_device_events_handler(libxl_ctx *ctx,
 
 out:
     GC_FREE;
-    return rc ? : AO_INPROGRESS;
+    if (rc) return AO_ABORT(rc);
+    return AO_INPROGRESS;
 }
 
 /******************************************************************************/
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/2 xl: Comment error handling in dolog

Coverity-ID: 1087116

---
 tools/libxl/xl_cmdimpl.c |    2 ++
 1 file changed, 2 insertions(+)
tools/libxl/xl_cmdimpl.c +2 -0
index 4fc46eb..1a7fd09 100644
@@ -352,6 +352,8 @@ static void dolog(const char *file, int line, const char *func, char *fmt, ...)
     rc = vasprintf(&s, fmt, ap);
     va_end(ap);
     if (rc >= 0)
+        /* we ignore write errors since we have no way to report them;
+         * the alternative would be to abort the whole program */
         libxl_write_exactly(NULL, logfile, s, rc, NULL, NULL);
     free(s);
 }
Signature · 1 line
1.7.10.4
#3 lore raw
In reply to Ian Jackson

Ian Jackson writes ("[PATCH 1/2] libxl: Fix error path in libxl_device_events_handler"):

Quoted 8 lines

libxl_device_events_handler would fail to call AO_ABORT if it failed; instead it would simply return rc. (This leaves the egc etc. from the now-abolished stack frame potentially live, and leaves the ctx locked.)

In xl, this is of no consequence, because xl will immediately exit in this situation. This is very likely to be true in any other callers (of which we don't know of any, anyway).

FAOD, I see no need for this to be in 4.4, although it should go in iff we are currently accepting trivial bugfixes.

Ian.

#4 lore raw
Quoted 6 lines · Ian Jackson

Ian Jackson writes ("[PATCH 1/2] libxl: Fix error path in libxl_device_events_handler"):

Quoted 5 lines

libxl_device_events_handler would fail to call AO_ABORT if it failed; instead it would simply return rc. (This leaves the egc etc. from the now-abolished stack frame potentially live, and leaves the ctx locked.)

Quoted 6 lines
Quoted 3 lines

In xl, this is of no consequence, because xl will immediately exit in this situation. This is very likely to be true in any other callers (of which we don't know of any, anyway).

FAOD, I see no need for this to be in 4.4, although it should go in iff we are currently accepting trivial bugfixes.

Acked + applied both.

#5 lore raw

Ian Campbell writes ("Re: [PATCH 1/2] libxl: Fix error path in libxl_device_events_handler"):

Quoted 5 lines · Ian Jackson
Quoted 2 lines

FAOD, I see no need for this to be in 4.4, although it should go in iff we are currently accepting trivial bugfixes.

Acked + applied both.

Backported to 4.4. The bug is not in 4.3.

Ian.