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

login
register
mail settings
Submitter Juergen Lock
Date Nov. 20, 2009, 10:23 p.m.
Message ID <20091120222303.GA16486@triton8.kn-bremen.de>
Download mbox | patch
Permalink /patch/38946/
State New
Headers show

Comments

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

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

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);