From: Laine Stump Date: Mon, 5 Mar 2012 19:53:48 +0000 (-0500) Subject: util: eliminate crash in virNetDevMacVLanCreateWithVPortProfile X-Git-Tag: v0.9.11-rc1~157 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2a9d55f45733ae63377007524b7a5609adfad03;p=thirdparty%2Flibvirt.git util: eliminate crash in virNetDevMacVLanCreateWithVPortProfile Commit 723d5c (added after the release of 0.9.10) adds a NetlinkEventClient for each interface sent to virNetDevMacVLanCreateWithVPortProfile. This should only be done if the interface actually *has* a virtPortProfile, otherwise the event handler would be a NOP. The bigger problem is that part of the setup to create the NetlinkEventClient is to do a memcpy of virtPortProfile - if it's NULL, this triggers a segv. This patch just qualifies the code that adds the client - if virtPortProfile is NULL, it's skipped. --- diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c index d36b326076..f38a98c815 100644 --- a/src/util/virnetdevmacvlan.c +++ b/src/util/virnetdevmacvlan.c @@ -913,7 +913,7 @@ create_name: goto disassociate_exit; } - if (virNetlinkEventServiceIsRunning()) { + if (virtPortProfile && virNetlinkEventServiceIsRunning()) { if (VIR_ALLOC(calld) < 0) goto memory_error; if ((calld->cr_ifname = strdup(cr_ifname)) == NULL)