dpif-netdev: Fix use-after-free error in reconfigure_datapath().
Found by Coverity.
Reported-at:
Acked-by: Justin Pettit
/*
- * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2016 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -3456,7 +3456,8 @@ reconfigure_datapath(struct dp_netdev *dp)
/* We only reconfigure the ports that we determined above, because they're
* not being used by any pmd thread at the moment. If a port fails to
* reconfigure we remove it from the datapath. */
- HMAP_FOR_EACH (port, node, &dp->ports) {
+ struct dp_netdev_port *next_port;
+ HMAP_FOR_EACH_SAFE (port, next_port, node, &dp->ports) {
int err;
if (!port->need_reconfigure) {
