Re: [PATCH 4.4 13/56] iio: trigger: free trigger resource correctly

From: Greg Kroah-Hartman
Date: Wed Nov 15 2017 - 11:11:43 EST


On Tue, Nov 14, 2017 at 08:14:34PM +0000, Ben Hutchings wrote:
> On Mon, 2017-11-13 at 13:55 +0100, Greg Kroah-Hartman wrote:
> > 4.4-stable review patch.  If anyone has any objections, please let me
> > know.
> >
> > ------------------
> >
> > From: Alison Schofield <amsfield22@xxxxxxxxx>
> >
> >
> > [ Upstream commit 10e840dfb0b7fc345082dd9e5fff3c1c02e7690e ]
> >
> > These stand-alone trigger drivers were using iio_trigger_put()
> > where they should have been using iio_trigger_free().  The
> > iio_trigger_put() adds a module_put which is bad since they
> > never did a module_get.
> >
> > In the sysfs driver, module_get/put's are used as triggers are
> > added & removed. This extra module_put() occurs on an error path
> > in the probe routine (probably rare).
> >
> > In the bfin-timer & interrupt trigger drivers, the module resources
> > are not explicitly managed, so it's doing a put on something that
> > was never get'd.  It occurs on the probe error path and on the
> > remove path (not so rare).
> >
> > Tested with the sysfs trigger driver.
> > The bfin & interrupt drivers were build tested & inspected only.
>
> In 4.4 the iio-trig-periodic-rtc seems to have the same bug (it has
> been removed upstream). Would it make sense to fix it in 4.4?

Probably, or if it has been removed for a good reason, we can always
remove it in 4.4 :)

thanks,

greg k-h