All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mikhail Kshevetskiy" <mikhail.kshevetskiy@iopsys.eu>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v6 15/17] pinctrl: airoha: add support of en7523 SoC
Date: Sun, 28 Jun 2026 14:57:40 +0000	[thread overview]
Message-ID: <20260628145740.C14051F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260628143733.273651-16-mikhail.kshevetskiy@iopsys.eu>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:

New issues:
- [High] Missing and incorrect electrical configuration (pull-up, pull-down, drive strength, open-drain) mappings for dedicated IO pins.
- [Low] The device tree binding example violates the schema's `const` constraint by using an incorrect compatible string.

Pre-existing issues:
- [High] Use-After-Free (UAF) of irq_domain in the interrupt handler on driver unbind due to incorrect devm registration order.
--

commit 11bb118efd0b8683f86390269dd15e4752a654e8
Author: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Subject: pinctrl: airoha: add support of en7523 SoC

This patch adds support for the Airoha EN7523 SoC pin controller and its
corresponding device tree binding schema.

> diff --git a/Documentation/devicetree/bindings/pinctrl/airoha,en7523-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/airoha,en7523-pinctrl.yaml
> new file mode 100644
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pinctrl/airoha,en7523-pinctrl.yaml
[ ... ]
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> +    pinctrl {
> +      compatible = "airoha,en7521-pinctrl";

[Severity: Low]
Does this compatible string match the schema's const constraint? The binding
definition specifies "airoha,en7523-pinctrl", so it seems this will cause a
dt_binding_check validation failure on the example block.

> diff --git a/drivers/pinctrl/airoha/pinctrl-en7523.c b/drivers/pinctrl/airoha/pinctrl-en7523.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/pinctrl/airoha/pinctrl-en7523.c
[ ... ]
> +static const struct airoha_pinctrl_conf pinctrl_pullup_conf[] = {
> +	PINCTRL_CONF_DESC(12, REG_GPIO_L_PU, BIT(0)),
> +	PINCTRL_CONF_DESC(13, REG_GPIO_L_PU, BIT(1)),
[ ... ]
> +	PINCTRL_CONF_DESC(40, REG_GPIO_L_PU, BIT(28)),
> +	PINCTRL_CONF_DESC(41, REG_GPIO_L_PU, BIT(29)),
> +};

[Severity: High]
Are we missing electrical configuration mappings for pins 2-9 here?

Also, are pins 40-41 being mapped to the wrong hardware registers? They appear
to be mapped to REG_GPIO_L_PU instead of their dedicated hardware registers
(e.g., REG_I2C_SDA_PU).

[ ... ]
> +static const struct airoha_pinctrl_match_data pinctrl_match_data = {
> +	.pinctrl_name = KBUILD_MODNAME,
> +	.pinctrl_owner = THIS_MODULE,
> +	.pins = pinctrl_pins,
[ ... ]
> +	.confs_info = {
> +		[AIROHA_PINCTRL_CONFS_PULLUP] = {
> +			.confs = pinctrl_pullup_conf,
> +			.num_confs = ARRAY_SIZE(pinctrl_pullup_conf),
> +		},
[ ... ]
> +		[AIROHA_PINCTRL_CONFS_DRIVE_E4] = {
> +			.confs = pinctrl_drive_e4_conf,
> +			.num_confs = ARRAY_SIZE(pinctrl_drive_e4_conf),
> +		},
> +	},
> +};

[Severity: High]
Should AIROHA_PINCTRL_CONFS_PCIE_RST_OD be included in this initialization?

Without it, applying standard device tree pin configurations (such as
drive-open-drain on PCIe resets) will fail with -EINVAL, causing driver
probe failures for dependent hardware like PCIe.

[ ... ]
> +static struct platform_driver airoha_pinctrl_driver = {
> +	.probe = airoha_pinctrl_probe,
> +	.driver = {
> +		.name = "pinctrl-airoha-en7523",
> +		.of_match_table = airoha_pinctrl_of_match,
> +	},
> +};

[Severity: High]
This is a pre-existing issue, but looking at how airoha_pinctrl_probe()
operates in the shared drivers/pinctrl/airoha/pinctrl-airoha.c:

drivers/pinctrl/airoha/pinctrl-airoha.c:airoha_pinctrl_add_gpiochip() {
    err = devm_request_irq(dev, irq, airoha_irq_handler, IRQF_SHARED,
                           dev_name(dev), pinctrl);
    ...
    return devm_gpiochip_add_data(dev, gc, pinctrl);
}

Does this lifecycle teardown sequence create a use-after-free on module unbind?

Because devres frees in reverse order, devm_gpiochip_add_data() is undone
first (freeing the irq_domain), and the irq handler is freed second. If an
interrupt fires in this window, airoha_irq_handler() will dereference the
freed girq->domain via irq_find_mapping(), leading to a kernel crash.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260628143733.273651-1-mikhail.kshevetskiy@iopsys.eu?part=15

  reply	other threads:[~2026-06-28 14:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-28 14:37 [PATCH v6 00/17] pinctrl: airoha: split on shared and SoC drivers, add more SoCs Mikhail Kshevetskiy
2026-06-28 14:37 ` [PATCH v6 01/17] dt-bindings: pinctrl: airoha: update/fix device tree binding schemas Mikhail Kshevetskiy
2026-06-28 19:15   ` Conor Dooley
2026-06-28 14:37 ` [PATCH v6 02/17] pinctrl: airoha: an7581: fix misprint in bitfield name Mikhail Kshevetskiy
2026-06-28 14:37 ` [PATCH v6 03/17] pinctrl: airoha: an7583: fix I2C0_SDA_PD register bit order Mikhail Kshevetskiy
2026-06-28 14:37 ` [PATCH v6 04/17] pinctrl: airoha: an7583: there is no mux to enable the second i2c bus Mikhail Kshevetskiy
2026-06-28 14:37 ` [PATCH v6 05/17] pinctrl: airoha: an7581: fix mux/conf of pcie_reset pins Mikhail Kshevetskiy
2026-06-28 14:37 ` [PATCH v6 06/17] pinctrl: airoha: an7583: fix muxing of non-gpio default pins Mikhail Kshevetskiy
2026-06-28 14:37 ` [PATCH v6 07/17] pinctrl: airoha: move common definitions to the separate header Mikhail Kshevetskiy
2026-06-28 14:37 ` [PATCH v6 08/17] pinctrl: airoha: split driver on shared code and SoC specific drivers Mikhail Kshevetskiy
2026-06-28 14:57   ` sashiko-bot
2026-06-28 14:37 ` [PATCH v6 09/17] pinctrl: airoha: an7581: remove en7581 prefix from variable names Mikhail Kshevetskiy
2026-06-28 14:37 ` [PATCH v6 10/17] pinctrl: airoha: an7583: remove an7583 prefix from variable names and definitions Mikhail Kshevetskiy
2026-06-28 14:37 ` [PATCH v6 11/17] pinctrl: airoha: an7583: rename registers to match its an7583 names Mikhail Kshevetskiy
2026-06-28 14:37 ` [PATCH v6 12/17] pinctrl: airoha: an7583: add support for npu_uart pinmux Mikhail Kshevetskiy
2026-06-28 14:37 ` [PATCH v6 13/17] pinctrl: airoha: an7583: add support for pon_alt pinmux Mikhail Kshevetskiy
2026-06-28 14:37 ` [PATCH v6 14/17] pinctrl: airoha: an7583: add support for olt pinmux Mikhail Kshevetskiy
2026-06-28 14:37 ` [PATCH v6 15/17] pinctrl: airoha: add support of en7523 SoC Mikhail Kshevetskiy
2026-06-28 14:57   ` sashiko-bot [this message]
2026-06-28 20:51   ` Rob Herring (Arm)
2026-06-28 14:37 ` [PATCH v6 16/17] pinctrl: airoha: try to find chip scu node by phandle first Mikhail Kshevetskiy
2026-06-28 14:54   ` sashiko-bot
2026-06-28 14:37 ` [PATCH v6 17/17] pinctrl: airoha: add support of an7563 SoC Mikhail Kshevetskiy
2026-06-28 14:55   ` sashiko-bot
2026-06-28 20:51   ` Rob Herring (Arm)

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=20260628145740.C14051F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=mikhail.kshevetskiy@iopsys.eu \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.