From: Ben Pfaff Date: Fri, 19 Nov 2010 21:07:56 +0000 (-0800) Subject: netdev-vport: Fix segfault on bad vport configuration. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44471ad36d13da6563a2244dcac863ac5e9e829b;p=openvswitch netdev-vport: Fix segfault on bad vport configuration. When a vport parse error occurs, the vport_class's parse_config function doesn't necessarily store a valid pointer into the vport_info's 'config' member, so netdev_vport_create() needs to supply a null pointer here to avoiding passing a wild pointer to free(). --- diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 7bc4d033..197e74bb 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -110,7 +110,7 @@ netdev_vport_parse_config(const struct netdev_class *netdev_class, info.devname = name; info.type = netdev_class->type; error = (c->parse_config)(&info, args); - *configp = info.config; + *configp = error ? NULL : info.config; return error; } else { if (!shash_is_empty(args)) {