From: Jiri Slaby <jirislaby@kernel.org>
To: Filip Jensen <dev-Felipe.Jensen@duagon.com>,
gregkh@linuxfoundation.org, ilpo.jarvinen@linux.intel.com,
mingo@kernel.org, tglx@kernel.org, osama.abdelkader@gmail.com,
kees@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
Jose Javier Rodriguez Barbarin
<dev-josejavier.rodriguez@duagon.com>
Subject: Re: [PATCH] serial: 8250: null ptr deref in has_acpi_companion
Date: Fri, 6 Mar 2026 07:11:39 +0100 [thread overview]
Message-ID: <d73206a1-cabc-4de4-b85b-90c13cc1e0d0@kernel.org> (raw)
In-Reply-To: <20260305163358.42599-1-dev-Felipe.Jensen@duagon.com>
Hi,
1) the subject says:
[PATCH] serial: 8250: null ptr deref in has_acpi_companion
I read it as you are *adding* a null ptr dereference.
2) do not cut&paste literally the ./scripts/get_maintainer.pl output. I
doubt Ingo and Thomas or others will help you with tty :P.
On 05. 03. 26, 17:33, Filip Jensen wrote:
> uart->port.dev is set in serial8250_register_8250_port if the port number
> is under the initial CONFIG_SERIAL_8250_RUNTIME_UARTS. If unset, it will
> depend upon up->port.dev being set by the particular serial driver. A
> faulty driver might not set this value and this leads to null pointer
> dereferenced later in has_acpi_companion and later at uart_add_one_port
> call:
>
> Oops: general protection fault, probably for non-canonical address
> KASAN: null-ptr-deref in range
> RIP: 0010:serial8250_register_8250_port+0xd34/0x2030
> drivers/tty/serial/8250/8250_core.c
>
> Reviewed-by: Jose Javier Rodriguez Barbarin <dev-josejavier.rodriguez@duagon.com>
> Signed-off-by: Filip Jensen <dev-Felipe.Jensen@duagon.com>
> ---
>
> For a case of a low level driver not setting this, cf.
> Link: https://lore.kernel.org/linux-serial/20260305162815.41818-1-dev-Felipe.Jensen@duagon.com/
>
> drivers/tty/serial/8250/8250_core.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
> index d2e2c5dfef99..8ac3f4efa7fd 100644
> --- a/drivers/tty/serial/8250/8250_core.c
> +++ b/drivers/tty/serial/8250/8250_core.c
> @@ -756,6 +756,8 @@ int serial8250_register_8250_port(const struct uart_8250_port *up)
> if (ret)
> goto err;
> }
> + if (!uart->port.dev)
> + goto err;
So ret actually can be unitialized, right?
thanks,
--
js
suse labs
prev parent reply other threads:[~2026-03-06 6:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 16:33 Filip Jensen
2026-03-06 6:11 ` Jiri Slaby [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=d73206a1-cabc-4de4-b85b-90c13cc1e0d0@kernel.org \
--to=jirislaby@kernel.org \
--cc=dev-Felipe.Jensen@duagon.com \
--cc=dev-josejavier.rodriguez@duagon.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=osama.abdelkader@gmail.com \
--cc=tglx@kernel.org \
/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
all inboxes | Powered by JetHome®