lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170727232612.23543-3-antonio.borneo@st.com>
Date:   Fri, 28 Jul 2017 01:26:11 +0200
From:   Antonio Borneo <borneo.antonio@...il.com>
To:     Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>, alsa-devel@...a-project.org
Cc:     Antonio Borneo <borneo.antonio@...il.com>,
        linux-kernel@...r.kernel.org, Wei Xu <xuwei5@...ilicon.com>,
        John Stultz <john.stultz@...aro.org>,
        linux-arm-kernel@...ts.infradead.org,
        Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
Subject: [PATCH v2 2/3] ASoC: soc-core: fix unbalanced of_node_get()/of_node_put()

From: Antonio Borneo <borneo.antonio@...il.com>

On Hikey target board, enabling CONFIG_OF_DYNAMIC triggers several
errors at kernel boot, like the following one
OF: ERROR: Bad of_node_put() on /soc/i2s@...18000/ports/port@...ndpoint
each followed by stack dump.

of_graph_get_port_parent() walks through the parents looking for a
node named "ports". At each step it uses of_get_next_parent() that
drops the current node with of_node_put().
Avoid dropping the initial node by calling of_node_get() before
of_graph_get_port_parent().

Tested with kernel v4.13-rc2 with hikey_defconfig taken from
https://git.linaro.org/people/john.stultz/android-dev.git
branch dev/hikey-mainline-WIP

This fixes commit a180e8b98843 ("ASoC: add snd_soc_get_dai_id()
function").

Signed-off-by: Antonio Borneo <borneo.antonio@...il.com>
---
To: Liam Girdwood <lgirdwood@...il.com>
To: Mark Brown <broonie@...nel.org>
To: Jaroslav Kysela <perex@...ex.cz>
To: Takashi Iwai <tiwai@...e.com>
To: alsa-devel@...a-project.org
Cc: linux-kernel@...r.kernel.org
Cc: Wei Xu <xuwei5@...ilicon.com>
Cc: John Stultz <john.stultz@...aro.org>
Cc: linux-arm-kernel@...ts.infradead.org
Cc: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
---
 sound/soc/soc-core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 921622a..a0f39de 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -4087,6 +4087,11 @@ int snd_soc_get_dai_id(struct device_node *ep)
 	struct device_node *node;
 	int ret;
 
+	/*
+	 * of_graph_get_port_parent() will call
+	 * of_node_put(). So, call of_node_get() here
+	 */
+	of_node_get(ep);
 	node = of_graph_get_port_parent(ep);
 
 	/*
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ