On Tue, Apr 2, 2024 at 4:08 PM Bartosz Golaszewski <brgl@xxxxxxxx> wrote: > > > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > > index 59ccf9a3e153..4c674a37bcfc 100644 > > --- a/drivers/gpio/gpiolib.c > > +++ b/drivers/gpio/gpiolib.c > > @@ -1179,7 +1179,7 @@ struct gpio_device *gpio_device_find(const void *data, > > > > gc = srcu_dereference(gdev->chip, &gdev->srcu); > > > > - if (gc && match(gc, data)) > > + if (device_is_registered(&gdev->dev) && gc && match(gc, data)) > > return gpio_device_get(gdev); > > } > > > > -- > > 2.44.0 > > > > Can you do what Andy suggested and move this check even before taking > the SRCU read lock? It doesn't protect the underlying kobject struct > in any way. > > Bart Oh, and please add a Fixes tag too. Bart