diff options
| author | Cezary Rojewski <cezary.rojewski@intel.com> | 2026-09-02 10:18:12 +0200 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-09-03 22:51:39 +0100 |
| commit | d4fa6f94b91137e329ea3f5b360e140b227bb696 (patch) | |
| tree | 1202ef42218d39337cc6caf5d018a2c77e8e14d0 | |
| parent | 363a6969f7f875b461236bf520d35f35c3b0e5b1 (diff) | |
| download | linux-next-d4fa6f94b91137e329ea3f5b360e140b227bb696.tar.gz linux-next-d4fa6f94b91137e329ea3f5b360e140b227bb696.zip | |
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: 0a5fb3cc28fd ("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>
| -rw-r--r-- | sound/soc/intel/avs/debugfs.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sound/soc/intel/avs/debugfs.c b/sound/soc/intel/avs/debugfs.c index 9ab503da3b75..bc02737720ab 100644 --- a/sound/soc/intel/avs/debugfs.c +++ b/sound/soc/intel/avs/debugfs.c @@ -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) |
