net: ethernet: aquantia: Handle error cleanup of start on open
authorNathan Rossi <nathan.rossi@digi.com>
Thu, 11 Feb 2021 05:17:57 +0000 (05:17 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Apr 2021 13:00:08 +0000 (15:00 +0200)
commitf2294a707f6334689a35d56d21ddafa12ca23e1a
tree14d9af86547ba40efe9fb5a4d66fdabf7c4ae79c
parent7d3ffc0993fed0ce5673453a12f72b8e335a88b5
net: ethernet: aquantia: Handle error cleanup of start on open

[ 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.

Signed-off-by: Nathan Rossi <nathan.rossi@digi.com>
Reviewed-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/aquantia/atlantic/aq_main.c