windfarm: decrement client count when unregistering

Paul Bolle pebolle at
Fri Aug 7 09:09:49 AEST 2015

On vr, 2015-08-07 at 00:21 +0200, Paul Bolle wrote:
> On wo, 2015-08-05 at 14:16 +1000, Michael Ellerman wrote:
> > I also get an oops when removing windfarm_lm75_sensor, so I suspect there are
> > gremlins in the module ref counting for windfarm.
> (This I haven't (yet) looked into.)

And that might be, sort of, related. Because oops is probably triggered
by the, it seems, rather straightforward chain of events triggered by
unloading an I2C module. (So windfarm_lm75_sensor refcount must be
zero.) Which gets interesting at:

                module_put(wf_lm75_sensor->sens->ops->owner /* THIS_MODULE */)

And in windfarm_lm75_sensor we trigger this issue because in the
.probe() function there appears to be no corresponding call to
try_module_get() preventing unloading the module, as we saw in windfarm_

So module refcounting looks broken for both these modules in opposite
ways. Gremlins indeed.

Good luck!

Paul Bolle

More information about the Linuxppc-dev mailing list