Skip to content

Commit

Permalink
intel_th: Don't leak module refcount on failure to activate
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: [email protected] # v4.8+
  • Loading branch information
virtuoso committed Mar 15, 2017
1 parent 4495c08 commit e609cce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/hwtracing/intel_th/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit e609cce

Please sign in to comment.