mirror of
https://github.com/torvalds/linux.git
synced 2026-09-14 16:10:02 +02:00
ASoC: Intel: avs: Fix unbalanced module reference count
strace_open() invokes try_module_get() which on success takes
the module reference. If any follow up operation causes
strace_open() to fail, the refcount shall be put down.
Fixes: 0a5fb3cc28 ("ASoC: Intel: avs: Keep module refcount up when gathering traces")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20260902081814.1590883-9-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
363a6969f7
commit
d4fa6f94b9
|
|
@ -9,6 +9,7 @@
|
|||
#include <linux/cleanup.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/kfifo.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/sched/signal.h>
|
||||
#include <linux/string_helpers.h>
|
||||
|
|
@ -236,15 +237,20 @@ static int strace_open(struct inode *inode, struct file *file)
|
|||
if (!try_module_get(adev->dev->driver->owner))
|
||||
return -ENODEV;
|
||||
|
||||
if (kfifo_initialized(&adev->trace_fifo))
|
||||
return -EBUSY;
|
||||
if (kfifo_initialized(&adev->trace_fifo)) {
|
||||
ret = -EBUSY;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = kfifo_alloc(&adev->trace_fifo, PAGE_SIZE, GFP_KERNEL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
goto err;
|
||||
|
||||
file->private_data = adev;
|
||||
return 0;
|
||||
err:
|
||||
module_put(adev->dev->driver->owner);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int strace_release(struct inode *inode, struct file *file)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user