All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Greg KH <greg@kroah.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>,
	Chunyan Zhang <zhang.chunyan@linaro.org>,
	laurent.fert@intel.com, yann.fouassier@intel.com,
	linux-kernel@vger.kernel.org,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>
Subject: [QUEUED v20160408 16/18] intel_th: Hold output driver module reference while capture is active
Date: Fri,  8 Apr 2016 17:56:39 +0300	[thread overview]
Message-ID: <1460127401-30801-17-git-send-email-alexander.shishkin@linux.intel.com> (raw)
In-Reply-To: <1460127401-30801-1-git-send-email-alexander.shishkin@linux.intel.com>

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

  parent reply	other threads:[~2016-04-08 14:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-08 14:56 [QUEUED v20160408 00/18] stm class/intel_th: Patches in my queue Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 01/18] MAINTAINERS: Add a git tree for the stm class Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 02/18] stm class: Fix integer boundary checks for master range Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 03/18] stm class: dummy_stm: Make nr_dummies parameter read-only Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 04/18] stm class: stm_heartbeat: Make nr_devs " Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 05/18] stm class: Remove a pointless line Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 06/18] stm class: Do not leak the chrdev in error path Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 07/18] stm class: Fix stm device initialization order Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 08/18] stm class: Remove unnecessary pointer increment Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 09/18] intel_th: pti: Do remove sysfs group on device removal Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 10/18] intel_th: msu: Handle kstrndup() failure Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 11/18] intel_th: Allow subdevice drivers to bring in own attribute groups Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 12/18] intel_th: msu: Create sysfs attributes using core driver's facility Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 13/18] intel_th: pti: " Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 14/18] intel_th: Fix activating a subdevice without a driver Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 15/18] intel_th: msu: Serialize enabling/disabling Alexander Shishkin
2016-04-08 14:56 ` Alexander Shishkin [this message]
2016-04-08 14:56 ` [QUEUED v20160408 17/18] intel_th: msu: Set fops::owner to prevent module from unloading Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 18/18] intel_th: msu: Release resources on removal Alexander Shishkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460127401-30801-17-git-send-email-alexander.shishkin@linux.intel.com \
    --to=alexander.shishkin@linux.intel.com \
    --cc=greg@kroah.com \
    --cc=laurent.fert@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=yann.fouassier@intel.com \
    --cc=zhang.chunyan@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.