linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: protect pinctrl_list add
@ 2014-02-03 11:39 Stanislaw Gruszka
  2014-02-03 21:12 ` Stephen Warren
  0 siblings, 1 reply; 6+ messages in thread
From: Stanislaw Gruszka @ 2014-02-03 11:39 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-kernel, Stephen Warren

We have few fedora bug reports about list corruption on pinctrl,
for example:
https://bugzilla.redhat.com/show_bug.cgi?id=1051918

Most likely corruption happen due lack of protection of pinctrl_list
when adding new nodes to it. Patch corrects that.

Fixes: 57b676f9c1b ("pinctrl: fix and simplify locking")
Cc: stable@vger.kernel.org
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
I only compile tested patch, also did not get test results from bug
reporters yet. But I'm pretty confident that patch fixes the problem
and does not cause any other deadlock.

 drivers/pinctrl/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 5ee61a4..cab020a 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -851,7 +851,9 @@ static struct pinctrl *create_pinctrl(struct device *dev)
 	kref_init(&p->users);
 
 	/* Add the pinctrl handle to the global list */
+	mutex_lock(&pinctrl_list_mutex);
 	list_add_tail(&p->node, &pinctrl_list);
+	mutex_unlock(&pinctrl_list_mutex);
 
 	return p;
 }
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-02-04 22:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-03 11:39 [PATCH] pinctrl: protect pinctrl_list add Stanislaw Gruszka
2014-02-03 21:12 ` Stephen Warren
2014-02-04  8:01   ` Stanislaw Gruszka
2014-02-04  8:07     ` [PATCH v2] " Stanislaw Gruszka
2014-02-04 17:09       ` Stephen Warren
2014-02-04 21:08       ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).