linux/drivers/soundwire
Harshit Mogalapalli 612cbe1aeb soundwire: bus: fix off-by-one when allocating slave IDs
[ Upstream commit 12d4fd9a65 ]

ida_alloc_max() interprets its max argument as inclusive.

Using SDW_FW_MAX_DEVICES(16) therefore allows an ID of 16 to be
allocated, but the IRQ domain created for the bus is sized for IDs
0-15.  If 16 is returned, irq_create_mapping() fails and the driver
ends up with an invalid IRQ mapping.

Limit the allocation to 0-15 by passing SDW_FW_MAX_DEVICES - 1.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202512240450.hlDH3nCs-lkp@intel.com/
Fixes: aab12022b0 ("soundwire: bus: Add internal slave ID and use for IRQs")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20260110201959.2523024-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-01-23 11:21:22 +01:00
..
amd_init.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
amd_init.h soundwire: amd: use inline function for register update 2024-03-28 23:39:50 +05:30
amd_manager.c soundwire updates for 6.17 2025-08-01 11:09:27 -07:00
amd_manager.h soundwire: amd: add soundwire host wake interrupt enable/disable sequence 2025-02-13 21:51:07 +05:30
bus.c soundwire: bus: add sdw_slave_get_current_bank helper 2025-09-18 22:24:27 +01:00
bus.h soundwire: bus: add send_async/wait APIs for BPT protocol 2025-03-10 12:31:18 +05:30
bus_type.c soundwire: bus: fix off-by-one when allocating slave IDs 2026-01-23 11:21:22 +01:00
cadence_master.c soundwire: cadence: add BTP/BRA helpers to format data 2025-03-10 12:31:19 +05:30
cadence_master.h soundwire: cadence: add BTP/BRA helpers to format data 2025-03-10 12:31:19 +05:30
debugfs.c soundwire: debugfs: add SCP_SDCA_IntStatX and SCP_SDCA_IntMaskX registers 2025-08-12 22:14:21 +05:30
dmi-quirks.c ASoC: Intel: common: DMI remap for rebranded Intel NUC M15 (LAPRC710) laptops 2024-02-08 21:23:19 +00:00
generic_bandwidth_allocation.c soundwire: only compute port params in specific stream states 2025-05-14 12:44:01 +01:00
intel.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
intel.h soundwire: intel: Add awareness of ACE3+ microphone privacy 2025-05-14 12:43:25 +01:00
intel_ace2x.c soundwire: update Intel BPT message length limitation 2025-06-09 21:42:18 +05:30
intel_ace2x_debugfs.c soundwire: intel: Add awareness of ACE3+ microphone privacy 2025-05-14 12:43:25 +01:00
intel_auxdevice.c soundwire: intel_auxdevice: add rt721 codec to wake_capable_list 2025-06-26 13:51:41 -07:00
intel_auxdevice.h soundwire: intel: export intel_resume_child_device 2024-04-11 22:52:51 +05:30
intel_bus_common.c soundwire: cadence: add soft-reset on startup 2024-10-10 17:44:41 +05:30
intel_init.c soundwire: intel: Add awareness of ACE3+ microphone privacy 2025-05-14 12:43:25 +01:00
irq.c soundwire: bus: Add internal slave ID and use for IRQs 2025-05-14 12:42:50 +01:00
irq.h soundwire: bus: Move irq mapping cleanup into devres 2024-12-23 11:41:09 +05:30
Kconfig soundwire: cadence: add BTP/BRA helpers to format data 2025-03-10 12:31:19 +05:30
Makefile soundwire: amd: refactor amd soundwire manager device node creation 2024-01-30 16:06:34 +00:00
master.c soundwire: constify the struct device_type usage 2024-03-03 19:28:06 +05:30
mipi_disco.c soundwire: Correct some property names 2025-06-26 13:51:23 -07:00
qcom.c soundwire: Use min() to improve code 2025-09-01 22:48:22 +05:30
slave.c soundwire: bus: add of_sdw_find_device_by_node helper 2025-09-18 22:24:26 +01:00
stream.c soundwire: stream: restore params when prepare ports fail 2025-07-21 10:43:20 +05:30
sysfs_local.h soundwire: sysfs: remove sdw_slave_sysfs_init() 2024-03-28 23:38:47 +05:30
sysfs_slave.c soundwire: Correct some typos in comments 2024-10-03 12:46:23 +05:30
sysfs_slave_dpn.c soundwire: sysfs: remove sdw_slave_sysfs_init() 2024-03-28 23:38:47 +05:30