aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwtracing/intel_th
diff options
context:
space:
mode:
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>2016-04-08 17:35:04 +0300
committerAlexander Shishkin <alexander.shishkin@linux.intel.com>2016-04-08 17:41:25 +0300
commite2ea295baf87d78f2ed86ce595b30c691b18b210 (patch)
tree329293f71d023e86600582c372a54b7e583b0156 /drivers/hwtracing/intel_th
parentintel_th: msu: Serialize enabling/disabling (diff)
downloadlinux-dev-e2ea295baf87d78f2ed86ce595b30c691b18b210.tar.xz
linux-dev-e2ea295baf87d78f2ed86ce595b30c691b18b210.zip
intel_th: Hold output driver module reference while capture is active
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> Reviewed-by: Laurent Fert <laurent.fert@intel.com>
Diffstat (limited to 'drivers/hwtracing/intel_th')
-rw-r--r--drivers/hwtracing/intel_th/core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c
index 20339470c2c6..1be543e8e42f 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,