lkml.org 
[lkml]   [2016]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[QUEUED v20160408 16/18] intel_th: Hold output driver module reference while capture is active
Date
Right now it's possible to unload the output subdevice's driver while
the capture to this output is active. Prevent this by holding the
output driver's module reference.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
drivers/hwtracing/intel_th/core.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c
index 20339470c2..1be543e8e4 100644
--- a/drivers/hwtracing/intel_th/core.c
+++ b/drivers/hwtracing/intel_th/core.c
@@ -189,6 +189,9 @@ static int intel_th_output_activate(struct intel_th_device *thdev)
if (!thdrv)
return -ENODEV;

+ if (!try_module_get(thdrv->driver.owner))
+ return -ENODEV;
+
if (thdrv->activate)
return thdrv->activate(thdev);

@@ -209,6 +212,8 @@ static void intel_th_output_deactivate(struct intel_th_device *thdev)
thdrv->deactivate(thdev);
else
intel_th_trace_disable(thdev);
+
+ module_put(thdrv->driver.owner);
}

static ssize_t active_show(struct device *dev, struct device_attribute *attr,
--
2.8.0.rc3
\
 
 \ /
  Last update: 2016-04-08 17:41    [W:0.094 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site