All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	 linux-serial <linux-serial@vger.kernel.org>
Subject: Re: [PATCH 1/3] serial: 8250_lpss: do not touch uninitialized line in ehl_serial_exit()
Date: Fri, 9 Oct 2026 14:11:53 +0300 (EEST)	[thread overview]
Message-ID: <5b38ebef-0df1-04a0-d736-d1c2295cd062@linux.intel.com> (raw)
In-Reply-To: <ef47d676a44346e058f29a00c8701484db722831.1791524724.git.jirislaby@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 2043 bytes --]

On Fri, 9 Oct 2026, Jiri Slaby (SUSE) wrote:

> lpss8250_probe() calls lpss->board->exit() on its error path. For the
> EHL board, that is ehl_serial_exit() and it does:
> serial8250_get_port(lpss->data.line)->dma = NULL;
> 
> But when lpss8250_dma_setup() or serial8250_register_8250_port() fails,
> lpss->data.line was never assigned. As lpss is kzalloc()ed, line is 0
> and ehl_serial_exit() clears the dma pointer of an unrelated port --
> serial8250_ports[0], i.e. ttyS0, which is often the console.
> 
> Initialize lpss->data.line to -1 in probe and skip the clearing in
> ehl_serial_exit() if no port was registered.
> 
> Fixes: 5318f70da7e8 ("serial: 8250_lpss: Balance reference count for PCI DMA device")
> Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
> Assisted-by: LLM
> --
> Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: linux-serial@vger.kernel.org
> ---
>  drivers/tty/serial/8250/8250_lpss.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/tty/serial/8250/8250_lpss.c b/drivers/tty/serial/8250/8250_lpss.c
> index 776ec1ef29d6..c5257847a94c 100644
> --- a/drivers/tty/serial/8250/8250_lpss.c
> +++ b/drivers/tty/serial/8250/8250_lpss.c
> @@ -183,6 +183,9 @@ static int ehl_serial_setup(struct lpss8250 *lpss, struct uart_port *port)
>  
>  static void ehl_serial_exit(struct lpss8250 *lpss)
>  {
> +	if (lpss->data.line < 0)
> +		return;
> +
>  	struct uart_8250_port *up = serial8250_get_port(lpss->data.line);

Declaration now ends up mid-function for a non-cleanup variable so this 
should be split to two lines.

>  
>  	up->dma = NULL;
> @@ -329,6 +332,8 @@ static int lpss8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  		return ret;
>  
>  	lpss->board = (struct lpss8250_board *)id->driver_data;
> +	/* for tests in lpss->board->exit() */
> +	lpss->data.line = -1;
>  
>  	memset(&uart, 0, sizeof(struct uart_8250_port));
>  
> 

-- 
 i.

  reply	other threads:[~2026-10-09 11:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1791524724.git.jirislaby@kernel.org>
2026-10-09  5:46 ` [PATCH 1/3] serial: 8250_lpss: do not touch uninitialized line in ehl_serial_exit() Jiri Slaby (SUSE)
2026-10-09 11:11   ` Ilpo Järvinen [this message]
2026-10-10  5:46   ` sashiko-bot
2026-10-11  9:29     ` Jiri Slaby
2026-10-09  5:46 ` [PATCH 2/3] serial: 8250_omap: set priv->line before enabling the IRQ Jiri Slaby (SUSE)
2026-10-10  5:46   ` sashiko-bot
2026-10-09  5:46 ` [PATCH 3/3] serial: 8250: make port operations work on struct uart_8250_port Jiri Slaby (SUSE)
2026-10-09 11:25   ` Ilpo Järvinen
2026-10-10  5:46   ` sashiko-bot

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=5b38ebef-0df1-04a0-d736-d1c2295cd062@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@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 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.