Re: [PATCH v2 0/4] gpio: fix SRCU bugs

From: Bartosz Golaszewski
Date: Wed Feb 14 2024 - 14:08:56 EST


On Wed, Feb 14, 2024 at 7:44 PM Paul E. McKenney <paulmck@xxxxxxxxxx> wrote:
>
> On Wed, Feb 14, 2024 at 09:44:15AM +0100, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> >
> > Here are four fixes to some bugs in recent SRCU changes. The first one fixes
> > an actual race condition. The other three just make lockdep happy.
>
> For 1/4-3/4:
>
> Acked-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
>
> For 4/4, you are playing with fire, but I will assume that you know what
> you are doing. ;-)
>

Up until this rework, this gdev->chip pointer could go from under any
user at any point. Now we have this gpio_device wrapper that provides
an entry point to using the chip safely while protected by the SRCU
read lock. Anyone who is still accessing gpio_chip directly (and not
being the GPIO provider themselves) is asking for trouble. There's
however no point in spamming lockdep splats in this case. I may end up
adding a warning to these routines.

Unfortunately, it's hard to fix 15 years of technical debt. :(

Thanks for the Acks.
Bartosz

[snip]