On Thu, Feb 26, 2026 at 5:59 AM Eelco Chaudron via dev <
[email protected]> wrote:

> Coverity reports a data race where coverage_read() accesses idx_count
> without holding the coverage_mutex, while coverage_run() writes to
> idx_count with the mutex held (as is done 1 out of 1 times when
> writing).
>
> The race occurs when coverage_read() reads idx_count to calculate the
> array index into c[i]->min[] without synchronization. If coverage_run()
> concurrently updates idx_count, coverage_read() could:
>
> 1. Read a stale value of idx_count with no memory barrier guaranteeing
>    visibility of the update
> 2. Access the wrong index in the min[] array, reporting statistics from
>    the wrong time slot
>
> Fix by capturing idx_count once while holding the mutex, then using
> that consistent snapshot value when accessing the arrays.
>
> Fixes: 98cf638b19c2 ("coverage: Reimplement the "ovs-appctl coverage/show"
> command.")
> Signed-off-by: Eelco Chaudron <[email protected]>
>
>
LGTM!

Acked-by: Mike Pattrick <[email protected]>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to