Skip to content

Commit b8a1b1c

Browse files
author
Roland Dreier
committed
IPoIB: Fix hang in napi_disable() if P_Key is never found
After commit fe25c56 ("IPoIB: Don't enable NAPI when it's already enabled"), if an interface is brought up but the corresponding P_Key never appears, then ipoib_stop() will hang in napi_disable(), because ipoib_open() returns before it does napi_enable(). Fix this by changing ipoib_open() to call napi_enable() even if the P_Key isn't present. Reported-by: Yossi Etigin <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
1 parent e0b325d commit b8a1b1c

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

drivers/infiniband/ulp/ipoib/ipoib_main.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,23 +106,17 @@ int ipoib_open(struct net_device *dev)
106106

107107
ipoib_dbg(priv, "bringing up interface\n");
108108

109-
set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
109+
if (!test_and_set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags))
110+
napi_enable(&priv->napi);
110111

111112
if (ipoib_pkey_dev_delay_open(dev))
112113
return 0;
113114

114-
napi_enable(&priv->napi);
115+
if (ipoib_ib_dev_open(dev))
116+
goto err_disable;
115117

116-
if (ipoib_ib_dev_open(dev)) {
117-
napi_disable(&priv->napi);
118-
return -EINVAL;
119-
}
120-
121-
if (ipoib_ib_dev_up(dev)) {
122-
ipoib_ib_dev_stop(dev, 1);
123-
napi_disable(&priv->napi);
124-
return -EINVAL;
125-
}
118+
if (ipoib_ib_dev_up(dev))
119+
goto err_stop;
126120

127121
if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) {
128122
struct ipoib_dev_priv *cpriv;
@@ -144,6 +138,15 @@ int ipoib_open(struct net_device *dev)
144138
netif_start_queue(dev);
145139

146140
return 0;
141+
142+
err_stop:
143+
ipoib_ib_dev_stop(dev, 1);
144+
145+
err_disable:
146+
napi_disable(&priv->napi);
147+
clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
148+
149+
return -EINVAL;
147150
}
148151

149152
static int ipoib_stop(struct net_device *dev)

0 commit comments

Comments
 (0)