On Wed, Sep 3, 2014 at 1:24 PM, Alex Wang wrote:
> After discussing with Pravin offline, it is good to use first get the
> reference
> and then access the 'port->netdev' for pmd check.
>
> So, use a nested if statement:
>
> @@ -1864,20 +1874,27 @@ pmd_load_queues(struct pmd_thread *f,
> index
After discussing with Pravin offline, it is good to use first get the
reference
and then access the 'port->netdev' for pmd check.
So, use a nested if statement:
@@ -1864,20 +1874,27 @@ pmd_load_queues(struct pmd_thread *f,
index = 0;
CMAP_FOR_EACH (port, node, &f->dp->ports) {
-
>
> > @@ -1864,7 +1874,10 @@ pmd_load_queues(struct pmd_thread *f,
> > index = 0;
> >
> > CMAP_FOR_EACH (port, node, &f->dp->ports) {
> > -if (netdev_is_pmd(port->netdev)) {
> > +/* Calls port_try_ref() to prevent the main thread
> > + * from deleting the port. */
On Tue, Sep 2, 2014 at 6:44 PM, Alex Wang wrote:
> When pmd thread interates through all ports for queue loading,
> the main thread may unreference and 'rcu-free' a port before
> pmd thread take new reference of it. This could cause pmd
> thread fail the reference and access freed memory later.
>
When pmd thread interates through all ports for queue loading,
the main thread may unreference and 'rcu-free' a port before
pmd thread take new reference of it. This could cause pmd
thread fail the reference and access freed memory later.
This commit fixes this race by introducing port_try_ref()