From: Greg KH <gregkh@linuxfoundation.org>
To: Filip Jensen <dev-Felipe.Jensen@duagon.com>
Cc: jirislaby@kernel.org, dev-jorge.sanjuangarcia@duagon.com,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
Jose Javier Rodriguez Barbarin
<dev-josejavier.rodriguez@duagon.com>
Subject: Re: [PATCH] 8250_men_mcb: port.dev unset can entail a null ptr deref
Date: Thu, 12 Mar 2026 14:42:00 +0100 [thread overview]
Message-ID: <2026031235-decay-macaroni-0ddb@gregkh> (raw)
In-Reply-To: <20260305162815.41818-1-dev-Felipe.Jensen@duagon.com>
On Thu, Mar 05, 2026 at 05:28:15PM +0100, Filip Jensen wrote:
> The dev field of the uart_port structure is needed in the later call to
> serial8250_register_8250_port and unless the port is part of the initial
> registered ports (cf. CONFIG_SERIAL_8250_RUNTIME_UARTS) with a dev
> already set, it will make a null pointer deref in has_acpi_companion
> and could also 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
>
> A proposal for a security check against this missing field in any driver
> for the 8250_core.c will be sent in another patch.
>
> Reviewed-by: Jose Javier Rodriguez Barbarin <dev-josejavier.rodriguez@duagon.com>
> Signed-off-by: Filip Jensen <dev-Felipe.Jensen@duagon.com>
> ---
> drivers/tty/serial/8250/8250_men_mcb.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/tty/serial/8250/8250_men_mcb.c b/drivers/tty/serial/8250/8250_men_mcb.c
> index 6373234da03d..259516078793 100644
> --- a/drivers/tty/serial/8250/8250_men_mcb.c
> +++ b/drivers/tty/serial/8250/8250_men_mcb.c
> @@ -214,6 +214,7 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev,
> uart.port.iotype = UPIO_MEM;
> uart.port.uartclk = men_lookup_uartclk(mdev);
> uart.port.irq = mcb_get_irq(mdev);
> + uart.port.dev = &mdev->dev;
> uart.port.mapbase = (unsigned long) mem->start
> + data->offset[i];
>
> --
> 2.34.1
>
What changed to require this patch? And can you fix up the same issues
that Jiri pointed out in your other patch like this?
thanks,
greg k-h
prev parent reply other threads:[~2026-03-12 13:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 16:28 [PATCH] 8250_men_mcb: port.dev unset can entail a null ptr deref Filip Jensen
2026-03-12 13:42 ` Greg KH [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=2026031235-decay-macaroni-0ddb@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=dev-Felipe.Jensen@duagon.com \
--cc=dev-jorge.sanjuangarcia@duagon.com \
--cc=dev-josejavier.rodriguez@duagon.com \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.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