Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1600255

[QUEUED v20170314 1/3] intel_th: msu: Don't leak module refcount on failure to activate

From Alexander Shishkin <alexander.shishkin@linux.intel.com>
Newsgroups linux.kernel
Subject [QUEUED v20170314 1/3] intel_th: msu: Don't leak module refcount on failure to activate
Date 2017-03-14 12:40 +0100
Message-ID <tkSY3-7U6-47@gated-at.bofh.it> (permalink)
References <tkSY1-7U6-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Output 'activation' may fail for the reasons of the output driver,
for example, if msc's buffer is not allocated. We forget, however,
to drop the module reference in this case. So each attempt at
activation in this case leaks a reference, preventing the module
from ever unloading.

This patch adds the missing module_put() in the activation error
path.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: stable@vger.kernel.org # v4.8+
---
 drivers/hwtracing/intel_th/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c
index cdd9b3b261..7563eceeaa 100644
--- a/drivers/hwtracing/intel_th/core.c
+++ b/drivers/hwtracing/intel_th/core.c
@@ -221,8 +221,10 @@ static int intel_th_output_activate(struct intel_th_device *thdev)
 	else
 		intel_th_trace_enable(thdev);
 
-	if (ret)
+	if (ret) {
 		pm_runtime_put(&thdev->dev);
+		module_put(thdrv->driver.owner);
+	}
 
 	return ret;
 }
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[QUEUED v20170314 0/3] intel_th: Fixes for 4.11 Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-03-14 12:40 +0100
  [QUEUED v20170314 2/3] intel_th: pci: Add Denverton SOC support Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-03-14 12:40 +0100
  [QUEUED v20170314 3/3] intel_th: pci: Add Gemini Lake support Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-03-14 12:40 +0100
  [QUEUED v20170314 1/3] intel_th: msu: Don't leak module refcount on failure to activate Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-03-14 12:40 +0100
  Re: [QUEUED v20170314 0/3] intel_th: Fixes for 4.11 Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-03-14 12:50 +0100

csiph-web