Re: [PATCH net v1 1/4] octeon_ep: fix race conditions in ndo_get_stats64
From: Jakub Kicinski
Date: Tue Dec 03 2024 - 21:23:14 EST
On Mon, 2 Dec 2024 23:21:27 -0800 Shinas Rasheed wrote:
> + clear_bit(OCTEP_DEV_STATE_OPEN, &oct->state);
> + /* Make sure device state open is cleared so that no more
> + * stats fetch can happen intermittently
> + */
> + smp_mb__after_atomic();
> + while (octep_drv_busy(oct))
> + msleep(20);
This is a poor re-implementation of a lock.
We have more lock types in Linux than I care to count now.
Please just use the right one. Hint, it's probably a spin lock or
RCU+synchronize_net() on close.
--
pw-bot: cr