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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YJurlxqQ9L+zzIAS@hovoldconsulting.com>
Date:   Wed, 12 May 2021 12:19:03 +0200
From:   Johan Hovold <johan@...nel.org>
To:     Dan Carpenter <dan.carpenter@...cle.com>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Denis Joseph Barrow <D.Barow@...ion.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Oliver Neukum <oneukum@...e.com>,
        Anirudh Rayabharam <mail@...rudhrb.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Rustam Kovhaev <rkovhaev@...il.com>,
        Zheng Yongjun <zhengyongjun3@...wei.com>,
        Emil Renner Berthing <kernel@...il.dk>,
        linux-usb@...r.kernel.org, netdev@...r.kernel.org,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH net] net: hso: check for allocation failure in
 hso_create_bulk_serial_device()

On Wed, May 12, 2021 at 01:09:04PM +0300, Dan Carpenter wrote:
> Add a couple checks for if these allocations fail.
> 
> Fixes: 542f54823614 ("tty: Modem functions for the HSO driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> ---
>  drivers/net/usb/hso.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
> index 3ef4b2841402..3b2a868d7a72 100644
> --- a/drivers/net/usb/hso.c
> +++ b/drivers/net/usb/hso.c
> @@ -2618,9 +2618,13 @@ static struct hso_device *hso_create_bulk_serial_device(
>  		num_urbs = 2;
>  		serial->tiocmget = kzalloc(sizeof(struct hso_tiocmget),
>  					   GFP_KERNEL);
> +		if (!serial->tiocmget)
> +			goto exit;

Nice catch; the next assignment would go boom if this ever failed.

This appears to have been introduced by 

	af0de1303c4e ("usb: hso: obey DMA rules in tiocmget")

>  		serial->tiocmget->serial_state_notification
>  			= kzalloc(sizeof(struct hso_serial_state_notification),
>  					   GFP_KERNEL);
> +		if (!serial->tiocmget->serial_state_notification)
> +			goto exit;
>  		/* it isn't going to break our heart if serial->tiocmget
>  		 *  allocation fails don't bother checking this.
>  		 */

You should remove this comment and drop the conditional on the following
line as well now, though.

Johan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ