Re: [PATCH] util: Prevent libvirtd crash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/28/2012 07:28 AM, Alex Jia wrote:
> * src/util/virnetdevopenvswitch.c (virNetDevOpenvswitchAddPort): avoid libvirtd
> crash due to derefing a NULL virtVlan->tag.
>
> RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=852383
>
> Signed-off-by: Alex Jia <ajia@xxxxxxxxxx>
> ---
>  src/util/virnetdevopenvswitch.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
> index 601d79e..7d38ff8 100644
> --- a/src/util/virnetdevopenvswitch.c
> +++ b/src/util/virnetdevopenvswitch.c
> @@ -100,7 +100,8 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
>                  virBufferAsprintf(buf, "%d", virtVlan->tag[i]);
>              }
>          } else {
> -            virBufferAsprintf(buf, "tag=%d", virtVlan->tag[0]);
> +            if (virtVlan->nTags)
> +                virBufferAsprintf(buf, "tag=%d", virtVlan->tag[0]);

While this does eliminate the crash, it shouldn't have been necessary,
and doesn't fix the root cause, which was a couple levels up in the
callstack. The real problem is that &net->vlan was being sent, rather
than virDomainNetGetActualVlan(net) (which returns NULL if the vlan info
found has no tags). I've sent a separate patch to fix that (I should
have caught it during review :-( ):

   https://www.redhat.com/archives/libvir-list/2012-August/msg01835.html


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]