[1/5] ASoC: rsnd: fix NULL dereference when remote port has no endpoint

Message ID 20261107160821263n_tb5YdtJX-icNTWJbOW9@zte.com.cn (mailing list archive)
State New
Headers
Series ASoC: fix error-path leaks and a NULL dereference |

Commit Message

shao.mingyin@zte.com.cn Nov. 7, 2026, 8:08 a.m. UTC
From: Shao Mingyin <shao.mingyin@zte.com.cn>

rsnd_parse_connect_graph() uses the node returned by
of_graph_get_remote_port_parent() without checking it for NULL.  An
endpoint node with no remote-endpoint phandle yields NULL, and the
following strstr() on remote_node->full_name dereferences it during
probe.

Return early when the remote node is absent, so a graph link that does
not lead anywhere is ignored instead of crashing the kernel.

Fixes: beed78aeeb10 ("ASoC: rsnd: move HDMI information from ssi.c to core.c")
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
  

Comments

Kuninori Morimoto Nov. 9, 2026, 2:02 a.m. UTC | #1
Hi Shao

Thank you for your patch

> rsnd_parse_connect_graph() uses the node returned by
> of_graph_get_remote_port_parent() without checking it for NULL.  An
> endpoint node with no remote-endpoint phandle yields NULL, and the
> following strstr() on remote_node->full_name dereferences it during
> probe.
> 
> Return early when the remote node is absent, so a graph link that does
> not lead anywhere is ignored instead of crashing the kernel.
> 
> Fixes: beed78aeeb10 ("ASoC: rsnd: move HDMI information from ssi.c to core.c")
> Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
> ---

Basically it shouldn't happen in of-graph case, but we shouldn't believe
sane DT.

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Thank you for your help !!

Best regards
---
Kuninori Morimoto
  

Patch

diff --git a/sound/soc/renesas/rcar/core.c b/sound/soc/renesas/rcar/core.c
index b7954746e953..6fba4f46868b 100644
--- a/sound/soc/renesas/rcar/core.c
+++ b/sound/soc/renesas/rcar/core.c
@@ -1140,6 +1140,8 @@  static void rsnd_parse_connect_graph(struct rsnd_priv *priv,
 		return;
 
 	remote_node = of_graph_get_remote_port_parent(endpoint);
+	if (!remote_node)
+		return;
 
 	/* HDMI0 */
 	if (strstr(remote_node->full_name, "hdmi@fead0000")) {