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

Ashish Mittal posted 1 patch 6 years, 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1506023847-3239-1-git-send-email-ashmit602@gmail.com
src/qemu/qemu_hotplug.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
[libvirt] [PATCH v4] Avoid possible NULL pointer dereferences in qemuDomainGetTLSObjects
Posted by Ashish Mittal 6 years, 7 months ago
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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v4] Avoid possible NULL pointer dereferences in qemuDomainGetTLSObjects
Posted by John Ferlan 6 years, 7 months ago

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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v4] Avoid possible NULL pointer dereferences in qemuDomainGetTLSObjects
Posted by ashish mittal 6 years, 7 months ago
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
>
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list