From: sashiko-bot@kernel.org
To: "Petar Stepanovic" <pstepanovic@axiado.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 2/2] gpio: axiado: add AX3005 SGPIO controller support
Date: Thu, 03 Sep 2026 07:22:49 +0000 [thread overview]
Message-ID: <20260903072249.CDD7F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260903-axiado-ax3000-sgpio-controller-v3-2-b30820e1b858@axiado.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The IRQ domain is instantiated and published before the driver's internal state (`sgpio->gpio`) is fully initialized, allowing concurrent IRQ requests to cause a NULL pointer dereference.
--
commit 4babc207a066bfa307e830995ecabfdcf12404d1
Author: Petar Stepanovic <pstepanovic@axiado.com>
gpio: axiado: add AX3005 SGPIO controller support
Add support for the Axiado AX3005 SGPIO controller.
Each SGPIO position provides one input GPIO and one output GPIO with
fixed directions. The driver registers the controller as a gpio_chip,
supports interrupts on input GPIOs, and uses regmap for register access.
> diff --git a/drivers/gpio/gpio-axiado-sgpio.c b/drivers/gpio/gpio-axiado-sgpio.c
> new file mode 100644
> index 0000000000000..a7c970217c59e
> --- /dev/null
> +++ b/drivers/gpio/gpio-axiado-sgpio.c
[ ... ]
> +static int axiado_sgpio_irq_request_resources(struct irq_data *d)
> +{
> + struct axiado_sgpio *sgpio = irq_data_get_irq_chip_data(d);
> +
> + return gpio_regmap_reqres_irq(sgpio->gpio, d->hwirq);
> +}
[ ... ]
> +static int axiado_sgpio_probe(struct platform_device *pdev)
> +{
[ ... ]
> + d_info.fwnode = dev_fwnode(&pdev->dev);
> + d_info.size = ngpio;
> + d_info.hwirq_max = ngpio;
> + d_info.ops = &axiado_sgpio_domain_ops;
> + d_info.host_data = sgpio;
> +
> + sgpio->domain = devm_irq_domain_instantiate(&pdev->dev, &d_info);
> + if (IS_ERR(sgpio->domain))
> + return PTR_ERR(sgpio->domain);
> +
> + config.parent = &pdev->dev;
> + config.regmap = sgpio->regmap;
> + config.ngpio = ngpio;
> + config.reg_dat_base = GPIO_REGMAP_ADDR(sgpio->regs->din_ss);
> + config.reg_set_base = GPIO_REGMAP_ADDR(sgpio->regs->dout_ss);
> + config.reg_mask_xlate = axiado_sgpio_reg_mask_xlate;
> + config.fixed_direction_output = sgpio->dir_out;
> + config.irq_domain = sgpio->domain;
> + config.drvdata = sgpio;
> +
> + sgpio->gpio = devm_gpio_regmap_register(&pdev->dev, &config);
[Severity: High]
Could concurrent IRQ mapping trigger a NULL pointer dereference here?
The IRQ domain is instantiated and published by devm_irq_domain_instantiate()
before sgpio->gpio is assigned by devm_gpio_regmap_register().
If a consumer driver probes concurrently and resolves the IRQ via the
device tree, it can call request_irq(), which invokes
axiado_sgpio_irq_request_resources().
That callback will dereference sgpio->gpio before it has been set:
return gpio_regmap_reqres_irq(sgpio->gpio, d->hwirq);
> + if (IS_ERR(sgpio->gpio))
> + return dev_err_probe(&pdev->dev, PTR_ERR(sgpio->gpio),
> + "Could not register gpiochip\n");
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903-axiado-ax3000-sgpio-controller-v3-0-b30820e1b858@axiado.com?part=2
next prev parent reply other threads:[~2026-09-03 7:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 7:11 [PATCH v3 0/2] gpio: Add support for Axiado AX3005 SGPIO controller Petar Stepanovic
2026-09-03 7:11 ` [PATCH v3 1/2] dt-bindings: gpio: add " Petar Stepanovic
2026-09-03 17:36 ` Conor Dooley
2026-09-03 7:11 ` [PATCH v3 2/2] gpio: axiado: add AX3005 SGPIO controller support Petar Stepanovic
2026-09-03 7:22 ` sashiko-bot [this message]
2026-09-03 8:59 ` Bartosz Golaszewski
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=20260903072249.CDD7F1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=pstepanovic@axiado.com \
--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.