[libvirt] [PATCH v4] Avoid possible NULL pointer dereferences in qemuDomainGetTLSObjects

Passing a NULL value for the argument secAlias to the function qemuDomainGetTLSObjects can cause a segmentation fault in libvirtd. Fixed two possibile places where we could dereference a NULL secAlias. Signed-off-by: Ashish Mittal <ashmit602@gmail.com> --- src/qemu/qemu_hotplug.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 7dd6e5f..7592049 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1638,12 +1638,14 @@ qemuDomainGetTLSObjects(virQEMUCapsPtr qemuCaps, if (qemuBuildSecretInfoProps(secinfo, secProps) < 0) return -1; - if (!(*secAlias = qemuDomainGetSecretAESAlias(srcAlias, false))) + if (!secAlias || + !(*secAlias = qemuDomainGetSecretAESAlias(srcAlias, false))) return -1; } if (qemuBuildTLSx509BackendProps(tlsCertdir, tlsListen, tlsVerify, - *secAlias, qemuCaps, tlsProps) < 0) + secAlias ? *secAlias : NULL, qemuCaps, + tlsProps) < 0) return -1; if (!(*tlsAlias = qemuAliasTLSObjFromSrcAlias(srcAlias))) -- 2.5.5

On 09/21/2017 03:57 PM, Ashish Mittal wrote:
Passing a NULL value for the argument secAlias to the function qemuDomainGetTLSObjects can cause a segmentation fault in libvirtd.
Fixed two possibile places where we could dereference a NULL secAlias.
Signed-off-by: Ashish Mittal <ashmit602@gmail.com> --- src/qemu/qemu_hotplug.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Pretty much what I did w/ the v3 source and already pushed. We're having *awful* long and I mean really long delays here at Red Hat getting list traffic over the last few days. So I had already pushed essentially the same thing... John

Thank you! Do let me know if there's any thing else I can help with on the remaining VxHS patches. Regards, Ashish On Thu, Sep 21, 2017 at 4:28 PM, John Ferlan <jferlan@redhat.com> wrote:
On 09/21/2017 03:57 PM, Ashish Mittal wrote:
Passing a NULL value for the argument secAlias to the function qemuDomainGetTLSObjects can cause a segmentation fault in libvirtd.
Fixed two possibile places where we could dereference a NULL secAlias.
Signed-off-by: Ashish Mittal <ashmit602@gmail.com> --- src/qemu/qemu_hotplug.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Pretty much what I did w/ the v3 source and already pushed. We're having *awful* long and I mean really long delays here at Red Hat getting list traffic over the last few days. So I had already pushed essentially the same thing...
John
participants (3)
-
Ashish Mittal
-
ashish mittal
-
John Ferlan