lkml.org 
[lkml]   [2024]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 8/8] serial: exar: fix: fix crash during shutdown if setup fails
On Tue, Apr 16, 2024 at 08:55:35AM -0400, Parker Newman wrote:
> From: Parker Newman <pnewman@connecttech.com>
>
> If a port fails to register with serial8250_register_8250_port() the
> kernel can crash when shutting down or module removal.
>
> This is because "priv->line[i]" will be set to a negative error code
> and in the exar_pci_remove() function serial8250_unregister_port() is
> called without checking if the "priv->line[i]" value is valid.
>
> Signed-off-by: Parker Newman <pnewman@connecttech.com>
> ---
> drivers/tty/serial/8250/8250_exar.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
> index 501b9f3e9c89..f5a395ed69d1 100644
> --- a/drivers/tty/serial/8250/8250_exar.c
> +++ b/drivers/tty/serial/8250/8250_exar.c
> @@ -1671,7 +1671,8 @@ static void exar_pci_remove(struct pci_dev *pcidev)
> unsigned int i;
>
> for (i = 0; i < priv->nr; i++)
> - serial8250_unregister_port(priv->line[i]);
> + if (priv->line[i] >= 0)
> + serial8250_unregister_port(priv->line[i]);

Is this a bug in the current driver? If so, can you resend it on its
own so we can get it merged now?

thanks,

greg k-h

\
 
 \ /
  Last update: 2024-04-17 13:19    [W:0.491 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site