diff --git a/net/tap.c b/net/tap.c index 69c905cdc100b1ff110f9cce23a2f614ba8028cd..b2e5908c357c01f99b4b866c1686c00ed3583f7f 100644 --- a/net/tap.c +++ b/net/tap.c @@ -399,6 +399,9 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan } fd = net_tap_init(opts, &vnet_hdr); + if (fd == -1) { + return -1; + } } s = net_tap_fd_init(vlan, "tap", name, fd, vnet_hdr);