[libvirt] [PATCH 1/3] virNetDevMacVLanCreateWithVPortProfile: Don't mask virNetDevMacVLanTapOpen error

Ján Tomko jtomko at redhat.com
Wed Aug 10 14:04:06 UTC 2016


On Tue, Aug 09, 2016 at 07:32:43PM +0200, Michal Privoznik wrote:
>https://bugzilla.redhat.com/show_bug.cgi?id=1240439
>
>In this function we create a macvtap device and open its tap
>device. Possibly multiple times.

Possibly multiple devices? Multiple times sounds like it's the same
device.

> Not the thing is, if opening the

s/Not/Now/ or s/Not the thing is, i/I/

>tap device fails, that is virNetDevMacVLanTapOpen() returns a
>negative value, we unroll all the changes BUT return 0 fooling
>caller into thinking everything went okay.
>
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>---
> src/util/virnetdevmacvlan.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
>index c05c67f..bd339c0 100644
>--- a/src/util/virnetdevmacvlan.c
>+++ b/src/util/virnetdevmacvlan.c
>@@ -1120,8 +1120,10 @@ virNetDevMacVLanCreateWithVPortProfile(const char *ifnameRequested,
>     }
>
>     if (flags & VIR_NETDEV_MACVLAN_CREATE_WITH_TAP) {
>-        if (virNetDevMacVLanTapOpen(ifnameCreated, tapfd, tapfdSize, 10) < 0)
>+        if (virNetDevMacVLanTapOpen(ifnameCreated, tapfd, tapfdSize, 10) < 0) {
>+            VIR_FORCE_CLOSE(rc); /* sets rc to -1 */

I know this is removed in the next patch, but closing fd 0 is just wrong
here.

ACK if you change it to just:

rc = -1;

Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160810/9b38bbf1/attachment-0001.sig>


More information about the libvir-list mailing list