Linux Serial subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yingjie Wang" <1075151112@qq.com>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH] serial: 8250: Disallow runtime changes to nr_uarts
Date: Sun, 25 Oct 2026 02:10:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-183978@kernel.org> (raw)
In-Reply-To: <tencent_23BFCCE74C508AD599E72011EAE5E409C006@qq.com>

> nr_uarts is clamped to UART_NR while the initial 8250 ports are
> initialized, but it is also used as the iteration bound by the remove
> path. serial8250_get_port() assumes that the index is within the
> serial8250_ports array.
> 
> Allowing nr_uarts to be changed through sysfs can therefore make the
> remove path access beyond the end of serial8250_ports. The value also
> describes the number of initialized or dynamically registered ports, so
> changing it after setup is not safe even when the new value is within the
> array limit.
> 
> Make the nr_uarts module parameter read-only through sysfs. Boot-time and
> module-load parameter parsing remain supported and still go through the
> existing clamp.
> 
> Tested on x86-64 with CONFIG_KASAN=y under QEMU:
> - 8250.nr_uarts=5 is honored at boot.
> - Writes to /sys/module/8250/parameters/nr_uarts are rejected.
> 
> Signed-off-by: Yingjie Wang <1075151112@qq.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_23BFCCE74C508AD599E72011EAE5E409C006@qq.com?part=1


      reply	other threads:[~2026-10-25  2:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-25  2:06 [PATCH] serial: 8250: Disallow runtime changes to nr_uarts Yingjie Wang
2026-10-25  2:10 ` sashiko-bot [this message]

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-183978@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=1075151112@qq.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox