svn commit: r345533 - stable/12/sys/dev/mlx4/mlx4_en

Hans Petter Selasky hselasky at FreeBSD.org
Tue Mar 26 13:37:58 UTC 2019


Author: hselasky
Date: Tue Mar 26 13:37:56 2019
New Revision: 345533
URL: https://svnweb.freebsd.org/changeset/base/345533

Log:
  MFC r344920:
  Teardown ifnet after stopping port in the mlx4en(4) driver.
  
  mlx4_en_stop_port() calls mlx4_en_put_qp() which can refer the link level
  address of the network interface, which in turn will be freed by the
  network interface detach function. Make sure the port is stopped
  before detaching the network interface.
  
  Sponsored by:		Mellanox Technologies

Modified:
  stable/12/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
==============================================================================
--- stable/12/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c	Tue Mar 26 13:35:23 2019	(r345532)
+++ stable/12/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c	Tue Mar 26 13:37:56 2019	(r345533)
@@ -1778,13 +1778,13 @@ void mlx4_en_destroy_netdev(struct net_device *dev)
 	if (priv->vlan_detach != NULL)
 		EVENTHANDLER_DEREGISTER(vlan_unconfig, priv->vlan_detach);
 
-	/* Unregister device - this will close the port if it was up */
-	if (priv->registered)
-		ether_ifdetach(dev);
-
 	mutex_lock(&mdev->state_lock);
 	mlx4_en_stop_port(dev);
 	mutex_unlock(&mdev->state_lock);
+
+	/* Unregister device - this will close the port if it was up */
+	if (priv->registered)
+		ether_ifdetach(dev);
 
 	if (priv->allocated)
 		mlx4_free_hwq_res(mdev->dev, &priv->res, MLX4_EN_PAGE_SIZE);


More information about the svn-src-all mailing list