netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: aquantia: Handle error cleanup of start on open
@ 2021-02-11  5:17 Nathan Rossi
  2021-02-11  8:22 ` [EXT] " Igor Russkikh
  2021-02-11 22:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Nathan Rossi @ 2021-02-11  5:17 UTC (permalink / raw)
  To: netdev
  Cc: Nathan Rossi, Nathan Rossi, Igor Russkikh, David S. Miller,
	Jakub Kicinski

From: Nathan Rossi <nathan.rossi@digi.com>

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.

Signed-off-by: Nathan Rossi <nathan.rossi@digi.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c
index 8f70a39099..4af0cd9530 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c
+++ 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)
---
2.30.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [EXT] [PATCH] net: ethernet: aquantia: Handle error cleanup of start on open
  2021-02-11  5:17 [PATCH] net: ethernet: aquantia: Handle error cleanup of start on open Nathan Rossi
@ 2021-02-11  8:22 ` Igor Russkikh
  2021-02-11 22:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Igor Russkikh @ 2021-02-11  8:22 UTC (permalink / raw)
  To: Nathan Rossi, netdev@vger.kernel.org
  Cc: Nathan Rossi, David S. Miller, Jakub Kicinski

> In order to correctly clean up the failed attempt to start a device call aq_nic_stop.
>
> Signed-off-by: Nathan Rossi <nathan.rossi@digi.com>

Looks good to me, thanks!

Reviewed-by: Igor Russkikh <irusskikh@marvell.com>

Igor

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ethernet: aquantia: Handle error cleanup of start on open
  2021-02-11  5:17 [PATCH] net: ethernet: aquantia: Handle error cleanup of start on open Nathan Rossi
  2021-02-11  8:22 ` [EXT] " Igor Russkikh
@ 2021-02-11 22:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-02-11 22:50 UTC (permalink / raw)
  To: Nathan Rossi; +Cc: netdev, nathan.rossi, irusskikh, davem, kuba

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Thu, 11 Feb 2021 05:17:57 +0000 you wrote:
> From: Nathan Rossi <nathan.rossi@digi.com>
> 
> 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.
> 
> [...]

Here is the summary with links:
  - net: ethernet: aquantia: Handle error cleanup of start on open
    https://git.kernel.org/netdev/net/c/8a28af7a3e85

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-11 22:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-11  5:17 [PATCH] net: ethernet: aquantia: Handle error cleanup of start on open Nathan Rossi
2021-02-11  8:22 ` [EXT] " Igor Russkikh
2021-02-11 22:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).