stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3.16-4.4] iio: iio-trig-periodic-rtc: Free trigger resource correctly
@ 2017-11-22 17:12 Ben Hutchings
  2017-11-28  9:19 ` Greg KH
  2017-11-28  9:27 ` Patch "iio: iio-trig-periodic-rtc: Free trigger resource correctly" has been added to the 3.18-stable tree gregkh
  0 siblings, 2 replies; 3+ messages in thread
From: Ben Hutchings @ 2017-11-22 17:12 UTC (permalink / raw)
  To: stable; +Cc: Alison Schofield, Jonathan Cameron

This is based on upstream commit 10e840dfb0b7, which did not touch the
iio-trig-periodic-rtc driver because it has been removed upstream.

The following explanation comes from that commit:

    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.

This was build tested only.

Cc: Alison Schofield <amsfield22@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
---
 drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
index 00d139331261..52430e57e346 100644
--- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
+++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
@@ -137,7 +137,7 @@ static int iio_trig_periodic_rtc_probe(struct platform_device *dev)
 		trig_info = kzalloc(sizeof(*trig_info), GFP_KERNEL);
 		if (!trig_info) {
 			ret = -ENOMEM;
-			goto error_put_trigger_and_remove_from_list;
+			goto error_free_trigger_and_remove_from_list;
 		}
 		iio_trigger_set_drvdata(trig, trig_info);
 		trig->ops = &iio_prtc_trigger_ops;
@@ -164,9 +164,9 @@ error_close_rtc:
 	rtc_class_close(trig_info->rtc);
 error_free_trig_info:
 	kfree(trig_info);
-error_put_trigger_and_remove_from_list:
+error_free_trigger_and_remove_from_list:
 	list_del(&trig->alloc_list);
-	iio_trigger_put(trig);
+	iio_trigger_free(trig);
 error_free_completed_registrations:
 	list_for_each_entry_safe(trig,
 				 trig2,
-- 
2.15.0.rc0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 3.16-4.4] iio: iio-trig-periodic-rtc: Free trigger resource correctly
  2017-11-22 17:12 [PATCH 3.16-4.4] iio: iio-trig-periodic-rtc: Free trigger resource correctly Ben Hutchings
@ 2017-11-28  9:19 ` Greg KH
  2017-11-28  9:27 ` Patch "iio: iio-trig-periodic-rtc: Free trigger resource correctly" has been added to the 3.18-stable tree gregkh
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2017-11-28  9:19 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: stable, Alison Schofield, Jonathan Cameron

On Wed, Nov 22, 2017 at 05:12:41PM +0000, Ben Hutchings wrote:
> This is based on upstream commit 10e840dfb0b7, which did not touch the
> iio-trig-periodic-rtc driver because it has been removed upstream.
> 
> The following explanation comes from that commit:
> 
>     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.
> 
> This was build tested only.
> 
> Cc: Alison Schofield <amsfield22@gmail.com>
> Cc: Jonathan Cameron <jic23@kernel.org>
> Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>

Thanks for the patch, now queued up.

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Patch "iio: iio-trig-periodic-rtc: Free trigger resource correctly" has been added to the 3.18-stable tree
  2017-11-22 17:12 [PATCH 3.16-4.4] iio: iio-trig-periodic-rtc: Free trigger resource correctly Ben Hutchings
  2017-11-28  9:19 ` Greg KH
@ 2017-11-28  9:27 ` gregkh
  1 sibling, 0 replies; 3+ messages in thread
From: gregkh @ 2017-11-28  9:27 UTC (permalink / raw)
  To: ben.hutchings, amsfield22, gregkh, jic23; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    iio: iio-trig-periodic-rtc: Free trigger resource correctly

to the 3.18-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     iio-iio-trig-periodic-rtc-free-trigger-resource-correctly.patch
and it can be found in the queue-3.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From ben.hutchings@codethink.co.uk  Tue Nov 28 10:18:28 2017
From: Ben Hutchings <ben.hutchings@codethink.co.uk>
Date: Wed, 22 Nov 2017 17:12:41 +0000
Subject: iio: iio-trig-periodic-rtc: Free trigger resource correctly
To: stable@vger.kernel.org
Cc: Alison Schofield <amsfield22@gmail.com>, Jonathan Cameron <jic23@kernel.org>
Message-ID: <20171122171231.lr54tqp3umbuexbs@xylophone.i.decadent.org.uk>
Content-Disposition: inline

From: Ben Hutchings <ben.hutchings@codethink.co.uk>

This is based on upstream commit 10e840dfb0b7, which did not touch the
iio-trig-periodic-rtc driver because it has been removed upstream.

The following explanation comes from that commit:

    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.

This was build tested only.

Cc: Alison Schofield <amsfield22@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/iio/trigger/iio-trig-periodic-rtc.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
+++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
@@ -137,7 +137,7 @@ static int iio_trig_periodic_rtc_probe(s
 		trig_info = kzalloc(sizeof(*trig_info), GFP_KERNEL);
 		if (!trig_info) {
 			ret = -ENOMEM;
-			goto error_put_trigger_and_remove_from_list;
+			goto error_free_trigger_and_remove_from_list;
 		}
 		iio_trigger_set_drvdata(trig, trig_info);
 		trig->ops = &iio_prtc_trigger_ops;
@@ -164,9 +164,9 @@ error_close_rtc:
 	rtc_class_close(trig_info->rtc);
 error_free_trig_info:
 	kfree(trig_info);
-error_put_trigger_and_remove_from_list:
+error_free_trigger_and_remove_from_list:
 	list_del(&trig->alloc_list);
-	iio_trigger_put(trig);
+	iio_trigger_free(trig);
 error_free_completed_registrations:
 	list_for_each_entry_safe(trig,
 				 trig2,


Patches currently in stable-queue which might be from ben.hutchings@codethink.co.uk are

queue-3.18/iio-iio-trig-periodic-rtc-free-trigger-resource-correctly.patch

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-28  9:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-22 17:12 [PATCH 3.16-4.4] iio: iio-trig-periodic-rtc: Free trigger resource correctly Ben Hutchings
2017-11-28  9:19 ` Greg KH
2017-11-28  9:27 ` Patch "iio: iio-trig-periodic-rtc: Free trigger resource correctly" has been added to the 3.18-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).