[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210405153743.GA305@amd>
Date: Mon, 5 Apr 2021 17:37:43 +0200
From: Pavel Machek <pavel@...x.de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Nathan Rossi <nathan.rossi@...i.com>,
Igor Russkikh <irusskikh@...vell.com>,
"David S. Miller" <davem@...emloft.net>,
Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 5.10 048/126] net: ethernet: aquantia: Handle error
cleanup of start on open
Hi!
> From: Nathan Rossi <nathan.rossi@...i.com>
>
> [ Upstream commit 8a28af7a3e85ddf358f8c41e401a33002f7a9587 ]
>
> The aq_nic_start function can fail in a variety of cases which leaves
> the device in broken state.
>
> An example case where the start function fails is the
> request_threaded_irq which can be interrupted, resulting in a EINTR
> result. This can be manually triggered by bringing the link up (e.g. ip
> link set up) and triggering a SIGINT on the initiating process (e.g.
> Ctrl+C). This would put the device into a half configured state.
> Subsequently bringing the link up again would cause the napi_enable to
> BUG.
>
> In order to correctly clean up the failed attempt to start a device call
> aq_nic_stop.
No.
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c
> @@ -71,8 +71,10 @@ static int aq_ndev_open(struct net_device *ndev)
> goto err_exit;
>
> err = aq_nic_start(aq_nic);
> - if (err < 0)
> + if (err < 0) {
> + aq_nic_stop(aq_nic);
> goto err_exit;
> + }
>
> err_exit:
> if (err < 0)
First, take a look at the goto. Does not need to be there.
Second check the crazy calling convention. If nic_start() fails, it
should clean up after itself.
Then, check the code. nic_stop() undoes initialization that was not
even done in the nic_start().
This introduces more problems than it solves.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists