]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
soundwire: fix bug in sdw_add_element_group_count found by syzkaller
authorBaoli.Zhang <baoli.zhang@linux.intel.com>
Wed, 6 May 2026 05:50:35 +0000 (13:50 +0800)
committerVinod Koul <vkoul@kernel.org>
Thu, 7 May 2026 07:34:37 +0000 (13:04 +0530)
commitf772ff5a0e6758fd412803c09e03ba3bca5f5878
tree3a43aefa167a0aacf9dc97e25b582275a0dcee62
parentc368dd5cbd61ffab2b6f8a89b0d5775e2e16cde6
soundwire: fix bug in sdw_add_element_group_count found by syzkaller

The original implementation caused an out-of-bounds memory access
in the sdw_add_element_group_count for-loop when i == num.

for (i = 0; i <= num; i++) {
    if (rate == group->rates[i] && lane == group->lanes[i])
        ...

To fix this error, the function now checks for existing rate/lane
entries in the group(a function parameter) using a for-loop before
adding them.

No functional changes apart from this fix.

Fixes: 9026118f20e2 ("soundwire: Add generic bandwidth allocation algorithm")
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Baoli.Zhang <baoli.zhang@linux.intel.com>
Link: https://patch.msgid.link/20260506055039.3751028-2-baoli.zhang@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/generic_bandwidth_allocation.c