[ovs-dev] [PATCH 2/6] netdev-vport: Fix theoretical null pointer dereference.
Ben Pfaff
blp at nicira.com
Thu Dec 27 19:34:00 UTC 2012
On Wed, Dec 26, 2012 at 05:16:42PM -0800, Ethan Jackson wrote:
> Theoretically, it's possible for netdev_get_status() to be called
> on a netdev-vport which hasn't had it's configuration set yet. In
s/it's/its/
> this case, netdev-vport would dereference a null pointer. This
> problem was found by Jesse Gross <jesse at nicira.com> in review.
I usually would write this as:
Reported-by: Jesse Gross <jesse at nicira.com>
> Signed-off-by: Ethan Jackson <ethan at nicira.com>
> ---
> lib/netdev-vport.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
> index e50103b..9bb5d36 100644
> --- a/lib/netdev-vport.c
> +++ b/lib/netdev-vport.c
> @@ -460,6 +460,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 it's
s/it's/its/
> + * configuration set yet. */
> + return NULL;
> + }
> +
More information about the dev
mailing list