diff mbox

[2/3] Avoid segfault on net_tap_init() failure

Message ID 20091120222303.GA16486@triton8.kn-bremen.de
State New
Headers show

Commit Message

Juergen Lock Nov. 20, 2009, 10:23 p.m. UTC
Check for fd == -1 there.

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
diff mbox

Patch

--- a/net/tap.c
+++ b/net/tap.c
@@ -400,6 +400,9 @@  int net_init_tap(QemuOpts *opts, Monitor
         }
 
         fd = net_tap_init(opts, &vnet_hdr);
+        if (fd == -1) {
+            return -1;
+        }
     }
 
     s = net_tap_fd_init(vlan, "tap", name, fd, vnet_hdr);