Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

intel_th: Don't leak module refcount on failure to activate

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>
Cc: stable@vger.kernel.org # v4.8+

+3 -1
+3 -1
drivers/hwtracing/intel_th/core.c
··· 221 221 else 222 222 intel_th_trace_enable(thdev); 223 223 224 - if (ret) 224 + if (ret) { 225 225 pm_runtime_put(&thdev->dev); 226 + module_put(thdrv->driver.owner); 227 + } 226 228 227 229 return ret; 228 230 }