[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<SEYPR06MB5134DB8DB445057FE187D1999D9B2@SEYPR06MB5134.apcprd06.prod.outlook.com>
Date: Wed, 11 Sep 2024 10:04:13 +0000
From: Jacky Chou <jacky_chou@...eedtech.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
CC: Andrew Lunn <andrew@...n.ch>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo
Abeni <pabeni@...hat.com>, Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>, Jacob Keller <jacob.e.keller@...el.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject:
回覆: 回覆: 回覆: [PATCH net-next] net: ftgmac100: Fix potential NULL dereference in error handling
Hi Dan,
> >
> > Could you share more detail about the crash is happening when you add a
> second goto?
> > I'm wondering if there are other things I missed.
>
> I'm saying if we add a feature in the future. Something like this.
>
> regards,
> dan carpenter
>
> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c
> b/drivers/net/ethernet/faraday/ftgmac100.c
> index f3cc14cc757d..417c7f4dd471 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c
> @@ -1562,10 +1562,22 @@ static int ftgmac100_open(struct net_device
> *netdev)
> goto err_ncsi;
> }
>
> + ret = some_new_feature();
> + if (ret)
> + goto err_free_ncsi;
> +
> return 0;
>
> +err_free_ncsi:
> + if (priv->use_ncsi)
> + ncsi_stop_dev(priv->ndev);
> err_ncsi:
> phy_stop(netdev->phydev);
> ^^^^^^^^^^^^^^
> Crash.
>
> napi_disable(&priv->napi);
> netif_stop_queue(netdev);
> err_alloc:
Thank you for the information.
I agree with this change.
Thanks,
Jacky
Powered by blists - more mailing lists