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:   Sat, 21 Sep 2019 18:40:09 -0700
From:   Jakub Kicinski <jakub.kicinski@...ronome.com>
To:     Allen Pais <allen.pais@...cle.com>
Cc:     netdev@...r.kernel.org, davem@...emloft.net,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drivers/net/fjes: fix a potential NULL pointer
 dereference

On Wed, 18 Sep 2019 22:03:15 +0530, Allen Pais wrote:
> alloc_workqueue is not checked for errors and as a result,
> a potential NULL dereference could occur.
> 
> Signed-off-by: Allen Pais <allen.pais@...cle.com>

If I'm looking at this right you are jumping to err_free_netdev without
setting the err variable. It must had been set to 0 from the return of
fjes_sw_init(). This means we will free the netdev, and return 0. This 
means probe will not fail and driver's remove function will be run
at some point. fjes_remove it will try to free the netdev again.

Looks like there's another existing bug here in that the work queues
are not free when something fails in fjes_probe, just the netdev.

Once you untangle that, and before you post a v2, could you please try
to identify which commit introduced the regression and provide an
appropriate "Fixes" tag?

> diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c
> index bbbc1dc..2d04104 100644
> --- a/drivers/net/fjes/fjes_main.c
> +++ b/drivers/net/fjes/fjes_main.c
> @@ -1237,8 +1237,15 @@ static int fjes_probe(struct platform_device *plat_dev)
>  	adapter->open_guard = false;
>  
>  	adapter->txrx_wq = alloc_workqueue(DRV_NAME "/txrx", WQ_MEM_RECLAIM, 0);
> +	if (unlikely(!adapter->txrx_wq))
> +		goto err_free_netdev;
> +
>  	adapter->control_wq = alloc_workqueue(DRV_NAME "/control",
>  					      WQ_MEM_RECLAIM, 0);
> +	if (unlikely(!adapter->control_wq)) {
> +		destroy_workqueue(adapter->txrx_wq);
> +		goto err_free_netdev;
> +	}
>  
>  	INIT_WORK(&adapter->tx_stall_task, fjes_tx_stall_task);
>  	INIT_WORK(&adapter->raise_intr_rxdata_task,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ