mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Linus Walleij <linusw@kernel.org>,
	Lokesh Vutla <lokeshvutla@ti.com>, Rob Herring <robh@kernel.org>,
	Nishanth Menon <nm@ti.com>, Tony Lindgren <tony@atomide.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 09/12] pinctrl: ti: iodelay: Protect generic group addition with pctldev->mutex
Date: Wed,  2 Dec 2026 09:30:03 +0000	[thread overview]
Message-ID: <6c2699633b5638906b68fdfce780823bee32851e.1796203691.git.lee@kernel.org> (raw)
In-Reply-To: <cover.1796203691.git.lee@kernel.org>

ti_iodelay_dt_node_to_map() calls pinctrl_generic_add_group() and
pinctrl_generic_get_group() without holding iod->pctl->mutex.  Both
helpers expect the caller to hold pctldev->mutex to serialise radix
tree mutations against concurrent consumer probes and pinctrl core
debugfs readers.

Acquire iod->pctl->mutex around pinctrl_generic_add_group() and the
subsequent pinctrl_generic_get_group() deduplication check.

Fixes: 003910ebc83b ("pinctrl: Introduce TI IOdelay configuration driver")
Closes: https://sashiko.dev/#/bug/linux-3aaee4c1-6bf8-47f0-b590-fb336372c247
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c
index 4a48cebbf2b3..f52d0af0794d 100644
--- a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c
+++ b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c
@@ -13,6 +13,7 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/module.h>
+#include <linux/mutex.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/property.h>
@@ -550,9 +551,12 @@ static int ti_iodelay_dt_node_to_map(struct pinctrl_dev *pctldev,
 	g->ncfg = i;
 	g->config = PIN_CONFIG_END;
 
+	mutex_lock(&iod->pctl->mutex);
 	error = pinctrl_generic_add_group(iod->pctl, np->name, pins, i, g);
-	if (error < 0)
+	if (error < 0) {
+		mutex_unlock(&iod->pctl->mutex);
 		goto free_data;
+	}
 
 	/*
 	 * The core deduplicates groups by name and keeps the first for the
@@ -566,6 +570,7 @@ static int ti_iodelay_dt_node_to_map(struct pinctrl_dev *pctldev,
 		devm_kfree(iod->dev, g);
 		g = grp->data;
 	}
+	mutex_unlock(&iod->pctl->mutex);
 
 	(*map)->type = PIN_MAP_TYPE_CONFIGS_GROUP;
 	(*map)->data.configs.group_or_pin = np->name;
-- 
2.56.1.911.g883d8bcb20-goog


  parent reply	other threads:[~2026-12-02  9:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  9:29 [PATCH 00/12] pinctrl: Fix Critical and High issues reported by Sashiko (batch 3) Lee Jones
2026-12-02  9:29 ` [PATCH 01/12] pinctrl: stm32: Validate npins against STM32_GPIO_PINS_PER_BANK Lee Jones
2026-12-02  9:29 ` [PATCH 02/12] pinctrl: imx: Validate pin_id in imx_pinctrl_parse_pin_mmio() Lee Jones
2026-12-02  9:29 ` [PATCH 03/12] pinctrl: single: Protect group and function updates with pctldev->mutex Lee Jones
2026-12-02 14:08   ` Bartosz Golaszewski
2026-12-02  9:29 ` [PATCH 04/12] pinctrl: imx: Propagate DT parsing errors in imx_pinctrl_probe_dt() Lee Jones
2026-12-02  9:29 ` [PATCH 05/12] pinctrl: tegra: Require at least one register bank in tegra_pinctrl_probe() Lee Jones
2026-12-02  9:30 ` [PATCH 06/12] pinctrl: imx: Serialise MMIO register updates with a spinlock Lee Jones
2026-12-02  9:30 ` [PATCH 07/12] pinctrl: nuvoton: ma35: Avoid double free of shared pin configs Lee Jones
2026-12-02  9:30 ` [PATCH 08/12] pinctrl: keembay: Check src before calling keembay_find_free_slot() Lee Jones
2026-12-02  9:30 ` Lee Jones [this message]
2026-12-02  9:30 ` [PATCH 10/12] pinctrl: sunxi: Serialise per-bank regulator request and free Lee Jones
2026-12-02  9:30 ` [PATCH 11/12] pinctrl: stm32: Protect irqmux restore with hwspinlock during resume Lee Jones
2026-12-02  9:30 ` [PATCH 12/12] pinctrl: sx150x: Register threaded IRQ after adding GPIO chip Lee Jones
2026-12-02  9:35   ` Neil Armstrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6c2699633b5638906b68fdfce780823bee32851e.1796203691.git.lee@kernel.org \
    --to=lee@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lokeshvutla@ti.com \
    --cc=nm@ti.com \
    --cc=robh@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®