lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 29 Nov 2023 13:34:23 +0000
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Haoran Liu <liuhaoran14@....com>
Cc:     jirislaby@...nel.org, linux-serial@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [tty/serial] 8250_acorn: Add error handling in
 serial_card_probe

On Wed, Nov 29, 2023 at 03:52:36AM -0800, Haoran Liu wrote:
> This patch adds error handling to the serial_card_probe
> function in drivers/tty/serial/8250/8250_acorn.c. The
> serial8250_register_8250_port call within this function
> previously lacked proper handling for failure scenarios.

You do have 72 columns to use if you want :)

> 
> Signed-off-by: Haoran Liu <liuhaoran14@....com>
> ---
>  drivers/tty/serial/8250/8250_acorn.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/tty/serial/8250/8250_acorn.c b/drivers/tty/serial/8250/8250_acorn.c
> index 758c4aa203ab..378ae6936028 100644
> --- a/drivers/tty/serial/8250/8250_acorn.c
> +++ b/drivers/tty/serial/8250/8250_acorn.c
> @@ -43,6 +43,7 @@ serial_card_probe(struct expansion_card *ec, const struct ecard_id *id)
>  	struct uart_8250_port uart;
>  	unsigned long bus_addr;
>  	unsigned int i;
> +	int ret;
>  
>  	info = kzalloc(sizeof(struct serial_card_info), GFP_KERNEL);
>  	if (!info)
> @@ -72,6 +73,14 @@ serial_card_probe(struct expansion_card *ec, const struct ecard_id *id)
>  		uart.port.mapbase = bus_addr + type->offset[i];
>  
>  		info->ports[i] = serial8250_register_8250_port(&uart);
> +		if (IS_ERR(info->ports[i])) {
> +			ret = PTR_ERR(info->ports[i]);
> +			while (i--)
> +				serial8250_unregister_port(info->ports[i]);
> +
> +			kfree(info);
> +			return ret;
> +		}

How was this found, and how was it tested?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ