Skip to contentSkip to conversation

net: ethernet: aquantia: Handle error cleanup of start on open

PATCH Applied Nathan Rossi 3 participants 3 messages Feb 11, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ethernet: aquantia: Handle error cleanup of start on open

From: Nathan Rossi <[email protected]>

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.

---
 drivers/net/ethernet/aquantia/atlantic/aq_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/aq_main.c +3 -1
index 8f70a39099..4af0cd9530 100644
@@ -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

#2 lore raw
In reply to Nathan Rossi
This patch was applied to netdev/net.git (refs/heads/master):

Hello:

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

Quoted 13 lines · On Thu, 11 Feb 2021 05:17:57 +0000 you wrote:

From: Nathan Rossi <[email protected]>

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.

Quoted 1 line

[...]

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