[ovs-dev] [PATCH] netdev-vport: Fix segfault on bad vport configuration.

Ben Pfaff blp at nicira.com
Fri Nov 19 21:08:02 UTC 2010


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().
---
 lib/netdev-vport.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index 7bc4d03..197e74b 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)) {
-- 
1.7.1





More information about the dev mailing list