From: sashiko-bot@kernel.org
To: "Changyul Lee" <lcy8047@gmail.com>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH] serial: mps2-uart: Remove the ports_idr entry when probe fails
Date: Fri, 06 Nov 2026 01:12:29 +0000 [thread overview]
Message-ID: <sashiko-outbox-200485@kernel.org> (raw)
In-Reply-To: <20261106010611.1708587-1-lcy8047@gmail.com>
> mps2_of_get_port() adds mps_port to ports_idr, but mps2_serial_probe()
> does not remove the entry when mps2_init_port() or uart_add_one_port()
> fails. mps_port is allocated with devm_kzalloc(), so devres frees it
> when probe fails, while ports_idr still points to it. When another port
> later registers the console, mps2_uart_console_setup() looks up the
> console index in ports_idr and uses the freed mps_port:
>
> BUG: KASAN: slab-use-after-free in uart_set_options+0x650/0x7a4
> Read of size 8 at addr ffff0000018c41a0 by task swapper/0/1
> Call trace:
> uart_set_options
> mps2_uart_console_setup
> try_enable_preferred_console
> register_console
> serial_core_register_port
> [ ... ]
>
> Remove the entry on both error paths.
>
> Fixes: 9f25e07b882b ("serial: mps2-uart: move to dynamic port allocation")
> Signed-off-by: Changyul Lee <lcy8047@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261106010611.1708587-1-lcy8047@gmail.com?part=1
next prev parent reply other threads:[~2026-11-06 1:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 1:06 [PATCH] serial: mps2-uart: Remove the ports_idr entry when probe fails Changyul Lee
2026-11-06 1:12 ` sashiko-bot [this message]
2026-11-11 14:17 ` Vladimir Murzin
2026-11-11 16:30 ` Arnd Bergmann
2026-11-11 19:00 ` Changyul Lee
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-200485@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=lcy8047@gmail.com \
--cc=linux-serial@vger.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.