Re: Conceptual bug on SoundWire probe/remove?

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

 



On Thu, 24 Mar 2022 11:12:34 +0100,
Srinivas Kandagatla wrote:
> 
> 
> 
> On 23/03/2022 19:45, Pierre-Louis Bossart wrote:
> > Hi,
> > I could use feedback/guidance on a possible conceptual bug in the
> > SoundWire probe and bus handling.
> >
> > When we probe a driver, the code does this:
> >
> > static int sdw_drv_probe(struct device *dev)
> > {
> >      struct sdw_slave *slave = dev_to_sdw_dev(dev);
> >      struct sdw_driver *drv = drv_to_sdw_driver(dev->driver);
> >      const struct sdw_device_id *id;
> >      const char *name;
> >      int ret;
> >
> >      /*
> >       * fw description is mandatory to bind
> >       */
> >      if (!dev->fwnode)
> >          return -ENODEV;
> >
> >      if (!IS_ENABLED(CONFIG_ACPI) && !dev->of_node)
> >          return -ENODEV;
> >
> >      id = sdw_get_device_id(slave, drv);
> >      if (!id)
> >          return -ENODEV;
> >
> >      slave->ops = drv->ops;
> 
> may be add try_module_get(dev->driver->owner) here, which should
> prevent the module from unloading in the first place.

The module refcount helps only partially, unfortunately.
The unbindig via sysfs is still allowed and it hits the very same
problem.


Takashi



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux