Skip to content

Commit 93e246b

Browse files
crojewsk-intelbroonie
authored andcommitted
ASoC: Intel: avs: Verify content returned by parse_int_array()
The first element of the returned array stores its length. If it is 0, any manipulation beyond the element at index 0 ends with null-ptr-deref. Fixes: 5a565ba ("ASoC: Intel: avs: Probing and firmware tracing over debugfs") Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://patch.msgid.link/20250530141025.2942936-8-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 5f342ae commit 93e246b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sound/soc/intel/avs/debugfs.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,14 +373,18 @@ static ssize_t trace_control_write(struct file *file, const char __user *from, s
373373
return ret;
374374

375375
num_elems = *array;
376-
resource_mask = array[1];
376+
if (!num_elems) {
377+
ret = -EINVAL;
378+
goto free_array;
379+
}
377380

378381
/*
379382
* Disable if just resource mask is provided - no log priority flags.
380383
*
381384
* Enable input format: mask, prio1, .., prioN
382385
* Where 'N' equals number of bits set in the 'mask'.
383386
*/
387+
resource_mask = array[1];
384388
if (num_elems == 1) {
385389
ret = disable_logs(adev, resource_mask);
386390
} else {

0 commit comments

Comments
 (0)