Skip to contentSkip to conversation

slimbus: ngd: Fix reference count leak in qcom_slim_ngd_notify_slaves

PATCH Applied Miaoqian Lin 5 participants 6 messages Oct 27, 2025 – Nov 12, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 slimbus: ngd: Fix reference count leak in qcom_slim_ngd_notify_slaves

The function qcom_slim_ngd_notify_slaves() calls of_slim_get_device() which internally uses device_find_child() to obtain a device reference. According to the device_find_child() documentation,
the caller must drop the reference with put_device() after use.

Found via static analysis and this is similar to commit 4e65bda8273c ("ASoC: wcd934x: fix error handling in wcd934x_codec_parse_data()")

Fixes 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver")
---
 drivers/slimbus/qcom-ngd-ctrl.c | 1 +
 1 file changed, 1 insertion(+)
drivers/slimbus/qcom-ngd-ctrl.c +1 -0
index 4fb66986cc22..cd40ab839c54 100644
@@ -1241,6 +1241,7 @@ static void qcom_slim_ngd_notify_slaves(struct qcom_slim_ngd_ctrl *ctrl)
 
 		if (slim_get_logical_addr(sbdev))
 			dev_err(ctrl->dev, "Failed to get logical address\n");
+		put_device(&sbdev->dev);
 	}
 }
 
Signature · 1 line
2.39.5 (Apple Git-154)
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Miaoqian Lin

The function qcom_slim_ngd_notify_slaves() calls of_slim_get_device() which internally uses device_find_child() to obtain a device reference. According to the device_find_child() documentation,
the caller must drop the reference with put_device() after use.

Found via static analysis and this is similar to commit 4e65bda8273c ("ASoC: wcd934x: fix error handling in wcd934x_codec_parse_data()")

Quoted 7 lines
Fixes 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver")
---
 drivers/slimbus/qcom-ngd-ctrl.c | 1 +
 1 file changed, 1 insertion(+)
Signature · 2 lines
With best wishes
Dmitry
maintainer Applied
#2 lore raw
In reply to Miaoqian Lin
Quoted 9 lines · Miaoqian Lin

The function qcom_slim_ngd_notify_slaves() calls of_slim_get_device() which internally uses device_find_child() to obtain a device reference. According to the device_find_child() documentation,
the caller must drop the reference with put_device() after use.

Found via static analysis and this is similar to commit 4e65bda8273c ("ASoC: wcd934x: fix error handling in wcd934x_codec_parse_data()")

[...]

Applied, thanks!

[1/1] slimbus: ngd: Fix reference count leak in qcom_slim_ngd_notify_slaves

      commit: 79d84af332094852614b15638f7ffe18f5f7966e

Best regards,

Signature · 1 line
Srinivas Kandagatla <[email protected]>
Applied
#3 lore raw
In reply to Miaoqian Lin
Quoted 9 lines · Miaoqian Lin

The function qcom_slim_ngd_notify_slaves() calls of_slim_get_device() which internally uses device_find_child() to obtain a device reference. According to the device_find_child() documentation,
the caller must drop the reference with put_device() after use.

Found via static analysis and this is similar to commit 4e65bda8273c ("ASoC: wcd934x: fix error handling in wcd934x_codec_parse_data()")

[...]

Applied, thanks!

[1/1] slimbus: ngd: Fix reference count leak in qcom_slim_ngd_notify_slaves

      commit: bcd8db9640bcad313f7fbf8433fcb5459cdd760a

Best regards,

Signature · 1 line
~Vinod
#4 lore raw
Quoted 7 lines · Vinod Koul
Quoted 5 lines · Miaoqian Lin

The function qcom_slim_ngd_notify_slaves() calls of_slim_get_device() which internally uses device_find_child() to obtain a device reference. According to the device_find_child() documentation,
the caller must drop the reference with put_device() after use.

Quoted 6 lines
Quoted 4 lines

Found via static analysis and this is similar to commit 4e65bda8273c ("ASoC: wcd934x: fix error handling in wcd934x_codec_parse_data()")

[...]

Applied, thanks!

These are slimbus patches? any reason why they are going via soundwire tree?

--srini>

Quoted 4 lines

[1/1] slimbus: ngd: Fix reference count leak in qcom_slim_ngd_notify_slaves

      commit: bcd8db9640bcad313f7fbf8433fcb5459cdd760a

Best regards,

#5 lore raw
Quoted 10 lines · Srinivas Kandagatla
Quoted 7 lines · Vinod Koul
Quoted 5 lines · Miaoqian Lin

The function qcom_slim_ngd_notify_slaves() calls of_slim_get_device() which internally uses device_find_child() to obtain a device reference. According to the device_find_child() documentation,
the caller must drop the reference with put_device() after use.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Found via static analysis and this is similar to commit 4e65bda8273c ("ASoC: wcd934x: fix error handling in wcd934x_codec_parse_data()")

[...]

Applied, thanks!

These are slimbus patches? any reason why they are going via soundwire tree?

My mistake, sorry :-( dropped now

Signature · 1 line
~Vinod