Re: [PATCH] atm/fore200e: Fix possible data race in fore200e_open()
From: Gui-Dong Han
Date: Thu Jan 16 2025 - 21:29:48 EST
> On Wed, 15 Jan 2025 13:10:06 +0000 Gui-Dong Han wrote:
> > Protect access to fore200e->available_cell_rate with rate_mtx lock to
> > prevent potential data race.
> >
> > The field fore200e.available_cell_rate is generally protected by the lock
> > fore200e.rate_mtx when accessed. In all other read and write cases, this
> > field is consistently protected by the lock, except for this case and
> > during initialization.
>
> That's not sufficient in terms of analysis.
>
> You need to be able to articulate what can go wrong.
fore200e->available_cell_rate += vcc->qos.txtp.max_pcr;
In this case, since the update depends on a prior read, a data race
could lead to a wrong fore200e.available_cell_rate value.
Regards,
Han