[ovs-dev] [PATCH v1] dpif-netdev: Retrieve dpif_class from struct dp_netdev

Ilya Maximets i.maximets at ovn.org
Sun Dec 8 14:42:44 UTC 2019


On 08.12.2019 15:29, Ophir Munk wrote:
> In case a pmd pointer (struct dp_netdev_pmd_thread *) needs to retrieve
> the dpif_class it points at - it can access it as:  pmd->dp->class.  A
> second option is to access it as: pmd->dp->dpif->dpif_class. The first
> option is safe since there is one dp netdev with a constant pointer to
> the dpif class. The second option is not safe since the pointer
> pmd->dp->dpif may be changed under the hood, for example, in case there
> is a call to dpif_open(). One such scenario is when a netdev bridge is
> running while dumping flows statistics with dpctl in parallel:
> ovs-appctl dpctl/dump-flows. This commit makes usage of the first
> safe option instead of the second option.
> 
> Fixes: 30115809da2e ("dpif-netdev: Use netdev-offload API for port lookup while offloading")
> Signed-off-by: Ophir Munk <ophirmu at mellanox.com>


Thanks Ophir!

I reproduced the issue locally and this patch will fix current case.
I'll re-check it and apply to master.

However, the root cause is that dpif_netdev_open() updates the 'dpif'
pointer on each call that ends up in using of a freed 'dpif'.  I'm
working on getting rid of this pointer from the dp_netdev strucutre,
so we'll not have same issue again.  Also, 'prerequisites' patch-set
still uses this pointer, so I'll need to update it.

Best regards, Ilya Maximets.


More information about the dev mailing list