]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
intel_th: Don't leak module refcount on failure to activate
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>
Fri, 24 Feb 2017 14:04:15 +0000 (16:04 +0200)
committerTim Gardner <tim.gardner@canonical.com>
Thu, 30 Mar 2017 12:35:45 +0000 (06:35 -0600)
BugLink: http://bugs.launchpad.net/bugs/1677589
commit e609ccef5222c73b46b322be7d3796d60bff353d upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/hwtracing/intel_th/core.c

index cdd9b3b26195aa38f03a910d10e483bca61edcca..7563eceeaaeaa3a4e70855a6d9622e960b0ab6c0 100644 (file)
@@ -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;
 }