When we detached a vport we would assign NULL to dp_port->vport
before calling synchronize_rcu(). However, since vports have a
longer lifetime than dp_ports there were no checks before
dereferencing dp_port->vport. This changes the behavior to
match the assumption by not assigning NULL during detach. This
avoids a potential NULL pointer dereference in do_output() among
other places.
p->port_no = port_no;
p->dp = dp;
+ p->vport = vport;
atomic_set(&p->sflow_pool, 0);
err = vport_attach(vport, p);
{
ASSERT_RTNL();
- if (dp_port->vport)
- return -EBUSY;
-
if (vport_get_dp_port(vport))
return -EBUSY;
return err;
}
- dp_port->vport = vport;
rcu_assign_pointer(vport->dp_port, dp_port);
return 0;
if (!dp_port)
return -EINVAL;
- dp_port->vport = NULL;
rcu_assign_pointer(vport->dp_port, NULL);
if (vport->ops->detach)