Ian Campbell
2015-Jul-13 12:31 UTC
[Pkg-xen-devel] Bug#784880: [PATCH for-4.6] tools: libxl: Handle failure to create qemu dm logfile
If libxl_create_logfile fails for some reason then libxl__create_qemu_logfile previously just carried on and dereferenced the uninitialised logfile. Check for the error from libxl_create_logfile, which has already logged for us. This was reported as Debian bug #784880. Reported-by: Russell Coker <russell at coker.com.au> Signed-off-by: Ian Campbell <ian.campbell at citrix.com> Cc: 784880 at bugs.debian.org --- Should be backported. --- tools/libxl/libxl_dm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index ad434f0..8ed2d2e 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -46,9 +46,11 @@ static const char *qemu_xen_path(libxl__gc *gc) static int libxl__create_qemu_logfile(libxl__gc *gc, char *name) { char *logfile; - int logfile_w; + int rc, logfile_w; + + rc = libxl_create_logfile(CTX, name, &logfile); + if (rc) return rc; - libxl_create_logfile(CTX, name, &logfile); logfile_w = open(logfile, O_WRONLY|O_CREAT|O_APPEND, 0644); free(logfile); -- 2.1.4
Wei Liu
2015-Jul-13 13:07 UTC
[Pkg-xen-devel] Bug#784880: [PATCH for-4.6] tools: libxl: Handle failure to create qemu dm logfile
On Mon, Jul 13, 2015 at 01:31:23PM +0100, Ian Campbell wrote:> If libxl_create_logfile fails for some reason then > libxl__create_qemu_logfile previously just carried on and dereferenced > the uninitialised logfile. > > Check for the error from libxl_create_logfile, which has already > logged for us. > > This was reported as Debian bug #784880. > > Reported-by: Russell Coker <russell at coker.com.au> > Signed-off-by: Ian Campbell <ian.campbell at citrix.com> > Cc: 784880 at bugs.debian.orgAcked-by: Wei Liu <wei.liu2 at citrix.com>> --- > Should be backported. > --- > tools/libxl/libxl_dm.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c > index ad434f0..8ed2d2e 100644 > --- a/tools/libxl/libxl_dm.c > +++ b/tools/libxl/libxl_dm.c > @@ -46,9 +46,11 @@ static const char *qemu_xen_path(libxl__gc *gc) > static int libxl__create_qemu_logfile(libxl__gc *gc, char *name) > { > char *logfile; > - int logfile_w; > + int rc, logfile_w; > + > + rc = libxl_create_logfile(CTX, name, &logfile); > + if (rc) return rc; > > - libxl_create_logfile(CTX, name, &logfile); > logfile_w = open(logfile, O_WRONLY|O_CREAT|O_APPEND, 0644); > free(logfile); > > -- > 2.1.4
Ian Campbell
2015-Jul-15 10:22 UTC
[Pkg-xen-devel] Bug#784880: [PATCH for-4.6] tools: libxl: Handle failure to create qemu dm logfile
On Mon, 2015-07-13 at 14:07 +0100, Wei Liu wrote:> On Mon, Jul 13, 2015 at 01:31:23PM +0100, Ian Campbell wrote: > > If libxl_create_logfile fails for some reason then > > libxl__create_qemu_logfile previously just carried on and dereferenced > > the uninitialised logfile. > > > > Check for the error from libxl_create_logfile, which has already > > logged for us. > > > > This was reported as Debian bug #784880. > > > > Reported-by: Russell Coker <russell at coker.com.au> > > Signed-off-by: Ian Campbell <ian.campbell at citrix.com> > > Cc: 784880 at bugs.debian.org > > Acked-by: Wei Liu <wei.liu2 at citrix.com>Applied, thanks. Ian, please:> > Should be backported.> > --- > > tools/libxl/libxl_dm.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c > > index ad434f0..8ed2d2e 100644 > > --- a/tools/libxl/libxl_dm.c > > +++ b/tools/libxl/libxl_dm.c > > @@ -46,9 +46,11 @@ static const char *qemu_xen_path(libxl__gc *gc) > > static int libxl__create_qemu_logfile(libxl__gc *gc, char *name) > > { > > char *logfile; > > - int logfile_w; > > + int rc, logfile_w; > > + > > + rc = libxl_create_logfile(CTX, name, &logfile); > > + if (rc) return rc; > > > > - libxl_create_logfile(CTX, name, &logfile); > > logfile_w = open(logfile, O_WRONLY|O_CREAT|O_APPEND, 0644); > > free(logfile); > > > > -- > > 2.1.4
Seemingly Similar Threads
- Bug#784880: [PATCH for-4.6] tools: libxl: Handle failure to create qemu dm logfile
- Bug#784880: xen-utils-4.4: xl segv when it can't rename log files
- [PATCH 0/2] libxl/xl: two more coverity related fixes
- XEN/arm XENFB support
- [PATCH V2 0/3] Set VNC password to QEMU upstream