Commit 61132bf7 authored by Marcelo Leitner's avatar Marcelo Leitner Committed by David S. Miller

qlge: Fix qlge_update_hw_vlan_features to handle if interface is down

Currently qlge_update_hw_vlan_features() will always first put the
interface down, then update features and then bring it up again. But it
is possible to hit this code while the adapter is down and this causes a
non-paired call to napi_disable(), which will get stuck.

This patch fixes it by skipping these down/up actions if the interface
is already down.

Fixes: a45adbe8 ("qlge: Enhance nested VLAN (Q-in-Q) handling.")
Cc: Harish Patil <harish.patil@qlogic.com>
Signed-off-by: default avatarMarcelo Ricardo Leitner <mleitner@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bdbbb852
...@@ -2351,23 +2351,29 @@ static int qlge_update_hw_vlan_features(struct net_device *ndev, ...@@ -2351,23 +2351,29 @@ static int qlge_update_hw_vlan_features(struct net_device *ndev,
{ {
struct ql_adapter *qdev = netdev_priv(ndev); struct ql_adapter *qdev = netdev_priv(ndev);
int status = 0; int status = 0;
bool need_restart = netif_running(ndev);
if (need_restart) {
status = ql_adapter_down(qdev); status = ql_adapter_down(qdev);
if (status) { if (status) {
netif_err(qdev, link, qdev->ndev, netif_err(qdev, link, qdev->ndev,
"Failed to bring down the adapter\n"); "Failed to bring down the adapter\n");
return status; return status;
} }
}
/* update the features with resent change */ /* update the features with resent change */
ndev->features = features; ndev->features = features;
if (need_restart) {
status = ql_adapter_up(qdev); status = ql_adapter_up(qdev);
if (status) { if (status) {
netif_err(qdev, link, qdev->ndev, netif_err(qdev, link, qdev->ndev,
"Failed to bring up the adapter\n"); "Failed to bring up the adapter\n");
return status; return status;
} }
}
return status; return status;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment