On Wed,  9 May 2018 11:43:33 +0200
Thomas Monjalon <tho...@monjalon.net> wrote:

>  
> +struct rte_eth_dev *
> +rte_eth_dev_allocated(const char *name)
> +{
> +     struct rte_eth_dev *ethdev;
> +
> +     rte_eth_dev_shared_data_prepare();
> +
> +     rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);
> +
> +     ethdev = rte_eth_dev_allocated_lock_free(name);
> +
> +     rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock);
> +
> +     return ethdev;
> +}
> +

Not sure about this. The code it self is correct, but it creates
a racy semantic.

If caller doesn't already hold a lock then there is no guarantee that
the device returned won't be destroyed by some other thread or that
the name was just allocated by some other process.

Reply via email to