[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y6LZEVU7tKPzjHQ8@localhost.localdomain>
Date: Wed, 21 Dec 2022 10:59:57 +0100
From: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Taku Izumi <izumi.taku@...fujitsu.com>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH net] fjes: Fix an error handling path in fjes_probe()
On Tue, Dec 20, 2022 at 09:57:06PM +0100, Christophe JAILLET wrote:
> A netif_napi_add() call is hidden in fjes_sw_init(). It should be undone
> by a corresponding netif_napi_del() call in the error handling path of the
> probe, as already done inthe remove function.
>
> Fixes: 265859309a76 ("fjes: NAPI polling function")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
> drivers/net/fjes/fjes_main.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c
> index 2513be6d4e11..01b4c9c6adbd 100644
> --- a/drivers/net/fjes/fjes_main.c
> +++ b/drivers/net/fjes/fjes_main.c
> @@ -1370,7 +1370,7 @@ static int fjes_probe(struct platform_device *plat_dev)
> adapter->txrx_wq = alloc_workqueue(DRV_NAME "/txrx", WQ_MEM_RECLAIM, 0);
> if (unlikely(!adapter->txrx_wq)) {
> err = -ENOMEM;
> - goto err_free_netdev;
> + goto err_del_napi;
> }
>
> adapter->control_wq = alloc_workqueue(DRV_NAME "/control",
> @@ -1431,6 +1431,8 @@ static int fjes_probe(struct platform_device *plat_dev)
> destroy_workqueue(adapter->control_wq);
> err_free_txrx_wq:
> destroy_workqueue(adapter->txrx_wq);
> +err_del_napi:
> + netif_napi_del(&adapter->napi);
> err_free_netdev:
> free_netdev(netdev);
> err_out:
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
I wonder if it won't be better to have fjes_sw_deinit() instead or
change fjes_sw_init to only netif_napi_add(). You know, to avoid another
bug here when someone add sth to the fjes_sw_deinit(). This is only
suggestion, patch looks fine.
> --
> 2.34.1
>
Powered by blists - more mailing lists