Re: [PATCH net-next v2 8/8] bng_en: implement ndo_get_stats64
From: Jakub Kicinski
Date: Thu Feb 26 2026 - 20:22:51 EST
On Thu, 26 Feb 2026 23:51:33 +0530 Bhargava Marreddy wrote:
> + set_bit(BNGE_STATE_READ_STATS, &bn->state);
> + /* Make sure bnge_close_core() sees that we are reading stats before
> + * we check the BNGE_STATE_OPEN flag.
> + */
> + smp_mb__after_atomic();
> + if (!test_bit(BNGE_STATE_OPEN, &bd->state)) {
> + clear_bit(BNGE_STATE_READ_STATS, &bn->state);
> + *stats = bn->net_stats_prev;
> + return;
> + }
There can be multiple concurrent readers. Two enter, first one gets
stalled second one exits clearing the bit, close frees the memory,
second reader proceeds to hit the NULL pointers.
Again, please don't try to invent synchronization primitives.
You can probably use RCU here.
--
pw-bot: cr