]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ASoC: sdw_utils: fix device reference leak in is_sdca_endpoint_present()
authorMiaoqian Lin <linmq006@gmail.com>
Wed, 29 Oct 2025 07:17:58 +0000 (15:17 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 6 Nov 2025 13:12:33 +0000 (13:12 +0000)
commit1a58d865f423f4339edf59053e496089075fa950
tree5900b797723b0d2b8ac1c52fce651d3e8395dfb8
parent6b6eddc63ce871897d3a5bc4f8f593e698aef104
ASoC: sdw_utils: fix device reference leak in is_sdca_endpoint_present()

The bus_find_device_by_name() function returns a device pointer with an
incremented reference count, but the original code was missing put_device()
calls in some return paths, leading to reference count leaks.

Fix this by ensuring put_device() is called before function exit after
  bus_find_device_by_name() succeeds

This follows the same pattern used elsewhere in the kernel where
bus_find_device_by_name() is properly paired with put_device().

Found via static analysis and code review.

Fixes: 4f8ef33dd44a ("ASoC: soc_sdw_utils: skip the endpoint that doesn't present")
Cc: stable@vger.kernel.org
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://patch.msgid.link/20251029071804.8425-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sdw_utils/soc_sdw_utils.c