From: Ben Pfaff Date: Fri, 19 Nov 2010 21:07:56 +0000 (-0800) Subject: netdev-vport: Fix segfault on bad vport configuration. X-Git-Tag: v1.1.0~829 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=44471ad36d13da6563a2244dcac863ac5e9e829b;p=sliver-openvswitch.git 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 7bc4d0338..197e74bb2 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)) {