drivers/pinctrl/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
When in the list_for_each_entry iteration, reload of p->state->settings
with a local setting from old_state will makes the list iteration in a
infinite loop.
The typical issue happened, it will frequently have printk message like:
"not freeing pin xx (xxx) as part of deactivating group xxx - it is
already used for some other setting".
This is a compiler-dependent problem, one instance was got using Clang
version 10.0 plus arm64 architecture.
Signed-off-by: Maria Yu <quic_aiquny@quicinc.com>
Cc: stable@vger.kernel.org
---
drivers/pinctrl/core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 1fa89be29b8f..f2977eb65522 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -1262,17 +1262,17 @@ static void pinctrl_link_add(struct pinctrl_dev *pctldev,
static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state)
{
struct pinctrl_setting *setting, *setting2;
- struct pinctrl_state *old_state = p->state;
+ struct pinctrl_state *old_state = READ_ONCE(p->state);
int ret;
- if (p->state) {
+ if (old_state) {
/*
* For each pinmux setting in the old state, forget SW's record
* of mux owner for that pingroup. Any pingroups which are
* still owned by the new state will be re-acquired by the call
* to pinmux_enable_setting() in the loop below.
*/
- list_for_each_entry(setting, &p->state->settings, node) {
+ list_for_each_entry(setting, &old_state->settings, node) {
if (setting->type != PIN_MAP_TYPE_MUX_GROUP)
continue;
pinmux_disable_setting(setting);
base-commit: 9bacdd8996c77c42ca004440be610692275ff9d0
--
2.17.1
Hi Maria, On Wed, Nov 15, 2023 at 2:13 AM Maria Yu <quic_aiquny@quicinc.com> wrote: > When in the list_for_each_entry iteration, reload of p->state->settings > with a local setting from old_state will makes the list iteration in a > infinite loop. > The typical issue happened, it will frequently have printk message like: > "not freeing pin xx (xxx) as part of deactivating group xxx - it is > already used for some other setting". > This is a compiler-dependent problem, one instance was got using Clang > version 10.0 plus arm64 architecture. > > Signed-off-by: Maria Yu <quic_aiquny@quicinc.com> > Cc: stable@vger.kernel.org Thanks, very much to the point. Can you please send a v3 and add the info Andy requested too, and I will apply it! Yours, Linus Walleij
On 11/15/2023 5:58 PM, Linus Walleij wrote: > Hi Maria, > > On Wed, Nov 15, 2023 at 2:13 AM Maria Yu <quic_aiquny@quicinc.com> wrote: > >> When in the list_for_each_entry iteration, reload of p->state->settings >> with a local setting from old_state will makes the list iteration in a >> infinite loop. >> The typical issue happened, it will frequently have printk message like: >> "not freeing pin xx (xxx) as part of deactivating group xxx - it is >> already used for some other setting". >> This is a compiler-dependent problem, one instance was got using Clang >> version 10.0 plus arm64 architecture. >> >> Signed-off-by: Maria Yu <quic_aiquny@quicinc.com> >> Cc: stable@vger.kernel.org > > Thanks, very much to the point. > > Can you please send a v3 and add the info Andy requested too, > and I will apply it! > > Yours, > Linus Walleij Thx Linus Walleij for your quick response. here it is: [https://lore.kernel.org/lkml/20231115102824.23727-1-quic_aiquny@quicinc.com/] -- Thx and BRs, Aiqun(Maria) Yu
© 2016 - 2025 Red Hat, Inc.