From: Ethan Jackson Date: Thu, 27 Dec 2012 01:02:08 +0000 (-0800) Subject: netdev-vport: Fix theoretical null pointer dereference. X-Git-Tag: sliver-openvswitch-1.9.90-3~10^2~50 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=9284baa2a4872f477722aa6fba2be8ad7b317f00;p=sliver-openvswitch.git netdev-vport: Fix theoretical null pointer dereference. Theoretically, its possible for netdev_get_status() to be called on a netdev-vport which hasn't had its configuration set yet. In this case, netdev-vport would dereference a null pointer. Reported-by: Jesse Gross Signed-off-by: Ethan Jackson --- diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index e93e5b4fe..94acd2603 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, 2012 Nicira, Inc. + * Copyright (c) 2010, 2011, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -465,6 +465,12 @@ netdev_vport_get_tnl_iface(const struct netdev *netdev) static char name[IFNAMSIZ]; ndv = netdev_dev_vport_cast(netdev_get_dev(netdev)); + if (!ndv->options) { + /* Race condition when 'ndv' was created, but did not have its + * configuration set yet. */ + return NULL; + } + if (tnl_port_config_from_nlattr(ndv->options->data, ndv->options->size, a)) { return NULL;