ACK/Cmnt: [PATCH] fjes: Handle workqueue allocation failure

Stefan Bader stefan.bader at canonical.com
Mon Feb 22 08:28:49 UTC 2021


On 19.02.21 20:16, Tim Gardner wrote:
> From: Will Deacon <will at kernel.org>
> 
> In the highly unlikely event that we fail to allocate either of the
> "/txrx" or "/control" workqueues, we should bail cleanly rather than
> blindly march on with NULL queue pointer(s) installed in the
> 'fjes_adapter' instance.
> 
> Cc: "David S. Miller" <davem at davemloft.net>
> Reported-by: Nicolas Waisman <nico at semmle.com>
> Link: https://lore.kernel.org/lkml/CADJ_3a8WFrs5NouXNqS5WYe7rebFP+_A5CheeqAyD_p7DFJJcg@mail.gmail.com/
> Signed-off-by: Will Deacon <will at kernel.org>
> Signed-off-by: David S. Miller <davem at davemloft.net>
> CVE-2019-16231
> [backported from 85ac30fa2e24f628e9f4f9344460f4015d33fd7d]
  ^ That should be (backported from commit ...)
    note the braces instead of the angled brackets
  We also started to add slight hinting about the backport like
  [rtg: simple context adjustments]
> Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
Acked-by: Stefan Bader <stefan.bader at canonical.com>
> ---

If you let us know what kind of content, this might be adjusted when applying.
But being nice and helpful might wear off.

-Stefan

>  drivers/net/fjes/fjes_main.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c
> index d8fcdc2414d8..f22dc23f8548 100644
> --- a/drivers/net/fjes/fjes_main.c
> +++ b/drivers/net/fjes/fjes_main.c
> @@ -1119,7 +1119,16 @@ static int fjes_probe(struct platform_device *plat_dev)
>  	adapter->open_guard = false;
>  
>  	adapter->txrx_wq = create_workqueue(DRV_NAME "/txrx");
> +	if (unlikely(!adapter->txrx_wq)) {
> +		err = -ENOMEM;
> +		goto err_free_netdev;
> +	}
> +
>  	adapter->control_wq = create_workqueue(DRV_NAME "/control");
> +	if (unlikely(!adapter->control_wq)) {
> +		err = -ENOMEM;
> +		goto err_free_txrx_wq;
> +	}
>  
>  	INIT_WORK(&adapter->tx_stall_task, fjes_tx_stall_task);
>  	INIT_WORK(&adapter->raise_intr_rxdata_task,
> @@ -1136,7 +1145,7 @@ static int fjes_probe(struct platform_device *plat_dev)
>  	hw->hw_res.irq = platform_get_irq(plat_dev, 0);
>  	err = fjes_hw_init(&adapter->hw);
>  	if (err)
> -		goto err_free_netdev;
> +		goto err_free_control_wq;
>  
>  	/* setup MAC address (02:00:00:00:00:[epid])*/
>  	netdev->dev_addr[0] = 2;
> @@ -1156,6 +1165,10 @@ static int fjes_probe(struct platform_device *plat_dev)
>  
>  err_hw_exit:
>  	fjes_hw_exit(&adapter->hw);
> +err_free_control_wq:
> +	destroy_workqueue(adapter->control_wq);
> +err_free_txrx_wq:
> +	destroy_workqueue(adapter->txrx_wq);
>  err_free_netdev:
>  	free_netdev(netdev);
>  err_out:
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20210222/26d8d400/attachment.sig>


More information about the kernel-team mailing list