Re: [PATCH] gpiolib: Fix triggering "kobject: 'gpiochipX' is not initialized, yet" kobject_get() errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux