mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-05-24 10:39:52 +00:00
ASoC: audio-graph-card: fix an use-after-free in graph_get_dai_id()
After calling of_node_put() on the node variable, it is still being
used, which may result in use-after-free.
Fix this issue by calling of_node_put() after the last usage.
Fixes: a0c426fe14
("ASoC: simple-card-utils: check "reg" property on asoc_simple_card_get_dai_id()")
Link: https://lore.kernel.org/r/1562743509-30496-5-git-send-email-wen.yang99@zte.com.cn
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
aa2e362cb6
commit
c152f8491a
1 changed files with 3 additions and 1 deletions
|
@ -63,6 +63,7 @@ static int graph_get_dai_id(struct device_node *ep)
|
||||||
struct device_node *endpoint;
|
struct device_node *endpoint;
|
||||||
struct of_endpoint info;
|
struct of_endpoint info;
|
||||||
int i, id;
|
int i, id;
|
||||||
|
u32 *reg;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* use driver specified DAI ID if exist */
|
/* use driver specified DAI ID if exist */
|
||||||
|
@ -83,8 +84,9 @@ static int graph_get_dai_id(struct device_node *ep)
|
||||||
return info.id;
|
return info.id;
|
||||||
|
|
||||||
node = of_get_parent(ep);
|
node = of_get_parent(ep);
|
||||||
|
reg = of_get_property(node, "reg", NULL);
|
||||||
of_node_put(node);
|
of_node_put(node);
|
||||||
if (of_get_property(node, "reg", NULL))
|
if (reg)
|
||||||
return info.port;
|
return info.port;
|
||||||
}
|
}
|
||||||
node = of_graph_get_port_parent(ep);
|
node = of_graph_get_port_parent(ep);
|
||||||
|
|
Loading…
Add table
Reference in a new issue