Make sure default VNET is set when adding a new interface in mlx5core.

Adding an interface might be done outside the device_attach() routine
and will then cause a panic, due to the VNET not being set.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
This commit is contained in:
hselasky 2018-03-07 14:49:27 +00:00
parent 7927756d5b
commit ab9224328e

View File

@ -956,7 +956,9 @@ static void mlx5_add_device(struct mlx5_interface *intf, struct mlx5_priv *priv)
dev_ctx = kmalloc(sizeof(*dev_ctx), GFP_KERNEL);
dev_ctx->intf = intf;
CURVNET_SET_QUIET(vnet0);
dev_ctx->context = intf->add(dev);
CURVNET_RESTORE();
if (dev_ctx->context) {
spin_lock_irq(&priv->ctx_lock);