All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Fil Dunsky" <filipp.dunsky@gmail.com>
Cc: linux-serial@vger.kernel.org, conor+dt@kernel.org,
	devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH RFC v2 07/10] tty: serial: Add Cortina UART driver
Date: Tue, 06 Oct 2026 18:27:41 +0000	[thread overview]
Message-ID: <sashiko-outbox-162340@kernel.org> (raw)
In-Reply-To: <20261006-b4-cs75xx-v2-7-b7d6e1e24d44@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] tty: serial: use-after-free due to __init on console setup
--

commit f274bba502abaeb866daa29a51921a3960bdaaa5
Author: Fil Dunsky <filipp.dunsky@gmail.com>

tty: serial: Add Cortina UART driver

This commit adds a driver for the UART found in Cortina SoCs. It supports
the system console and earlycon, using the current serial core API and devm
resource management.

> diff --git a/drivers/tty/serial/cortina-uart.c b/drivers/tty/serial/cortina-uart.c
> new file mode 100644
> index 0000000000000..1952629de0522
> --- /dev/null
> +++ b/drivers/tty/serial/cortina-uart.c
> @@ -0,0 +1,583 @@

[ ... ]

> +static int __init cortina_uart_console_setup(struct console *co, char *options)
> +{
> +	struct cortina_uart_port *up;

[Severity: High]
Is it safe to mark this function with __init?

Since cortina_uart_probe() uses devm_clk_get_enabled() which can return
-EPROBE_DEFER, the platform device might probe long after the boot process
has finished and the .init.text section has been freed.

During a post-boot probe, uart_add_one_port() invokes register_console(),
which unconditionally calls the console's .setup callback. If
cortina_uart_console_setup() is marked as __init, jumping to it at this
point would cause a kernel panic due to executing freed memory.

[ ... ]

> +static int cortina_uart_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;

[ ... ]

> +	up->clk = devm_clk_get_enabled(dev, NULL);
> +	if (IS_ERR(up->clk))
> +		return dev_err_probe(dev, PTR_ERR(up->clk), "failed to get clock\n");

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261006-b4-cs75xx-v2-0-b7d6e1e24d44@gmail.com?part=7

  reply	other threads:[~2026-10-06 18:27 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 18:17 [PATCH RFC v2 00/10] ARM: Add support for Cortina Systems CS75xx and Securifi Almond+ Fil Dunsky via B4 Relay
2026-10-06 18:17 ` Fil Dunsky
2026-10-06 18:17 ` [PATCH RFC v2 01/10] dt-bindings: vendor-prefixes: Add Securifi Fil Dunsky via B4 Relay
2026-10-06 18:17   ` Fil Dunsky
2026-10-06 18:18   ` sashiko-bot
2026-10-06 18:17 ` [PATCH RFC v2 02/10] dt-bindings: arm: Add Cortina Systems CS7542 and Securifi Almond+ Fil Dunsky via B4 Relay
2026-10-06 18:17   ` Fil Dunsky
2026-10-06 18:20   ` sashiko-bot
2026-10-06 18:17 ` [PATCH RFC v2 03/10] dt-bindings: arm: cpus: Add Cortina Systems CS7542 enable method Fil Dunsky via B4 Relay
2026-10-06 18:17   ` Fil Dunsky
2026-10-06 18:21   ` sashiko-bot
2026-10-06 18:17 ` [PATCH RFC v2 04/10] ARM: goldengate: Add support for the CS75xx SoC family Fil Dunsky via B4 Relay
2026-10-06 18:17   ` Fil Dunsky
2026-10-06 18:31   ` sashiko-bot
2026-10-07 11:40   ` Linus Walleij
2026-10-06 18:17 ` [PATCH RFC v2 05/10] ARM: debug: Add Cortina Systems CS75xx UART0 support Fil Dunsky via B4 Relay
2026-10-06 18:17   ` Fil Dunsky
2026-10-06 18:25   ` sashiko-bot
2026-10-06 18:17 ` [PATCH RFC v2 06/10] dt-bindings: serial: Add Cortina Systems CS7542 UART Fil Dunsky via B4 Relay
2026-10-06 18:17   ` Fil Dunsky
2026-10-06 18:19   ` sashiko-bot
2026-10-07 11:40   ` Linus Walleij
2026-10-06 18:17 ` [PATCH RFC v2 07/10] tty: serial: Add Cortina UART driver Fil Dunsky via B4 Relay
2026-10-06 18:17   ` Fil Dunsky
2026-10-06 18:27   ` sashiko-bot [this message]
2026-10-06 18:17 ` [PATCH RFC v2 08/10] ARM: dts: cortina: Add CS7542 SoC and Securifi Almond+ board Fil Dunsky via B4 Relay
2026-10-06 18:17   ` Fil Dunsky
2026-10-06 18:23   ` sashiko-bot
2026-10-07 11:41   ` Linus Walleij
2026-10-06 18:17 ` [PATCH RFC v2 09/10] ARM: multi_v7_defconfig: Enable Cortina Systems CS75xx support Fil Dunsky via B4 Relay
2026-10-06 18:17   ` Fil Dunsky
2026-10-06 18:21   ` sashiko-bot
2026-10-07 11:42   ` Linus Walleij
2026-10-06 18:17 ` [PATCH RFC v2 10/10] MAINTAINERS: Add entry for Cortina Systems CS75xx Fil Dunsky via B4 Relay
2026-10-06 18:17   ` Fil Dunsky
2026-10-07 11:42   ` Linus Walleij

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=sashiko-outbox-162340@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=filipp.dunsky@gmail.com \
    --cc=linux-serial@vger.kernel.org \
    --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.