Commit b6e01232 authored by Tariq Toukan's avatar Tariq Toukan Committed by David S. Miller

net/mlx4_en: Free netdev resources under state lock

Make sure mlx4_en_free_resources is called under the netdev state lock.
This is needed since RCU dereference of XDP prog should be protected.

Fixes: 326fe02d ("net/mlx4_en: protect ring->xdp_prog with rcu_read_lock")
Signed-off-by: default avatarTariq Toukan <tariqt@mellanox.com>
Reported-by: default avatarSagi Grimberg <sagi@grimberg.me>
CC: Brenden Blanco <bblanco@plumgrid.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a4cd0271
...@@ -129,6 +129,9 @@ static enum mlx4_net_trans_rule_id mlx4_ip_proto_to_trans_rule_id(u8 ip_proto) ...@@ -129,6 +129,9 @@ static enum mlx4_net_trans_rule_id mlx4_ip_proto_to_trans_rule_id(u8 ip_proto)
} }
}; };
/* Must not acquire state_lock, as its corresponding work_sync
* is done under it.
*/
static void mlx4_en_filter_work(struct work_struct *work) static void mlx4_en_filter_work(struct work_struct *work)
{ {
struct mlx4_en_filter *filter = container_of(work, struct mlx4_en_filter *filter = container_of(work,
...@@ -2189,13 +2192,13 @@ void mlx4_en_destroy_netdev(struct net_device *dev) ...@@ -2189,13 +2192,13 @@ void mlx4_en_destroy_netdev(struct net_device *dev)
mutex_lock(&mdev->state_lock); mutex_lock(&mdev->state_lock);
mdev->pndev[priv->port] = NULL; mdev->pndev[priv->port] = NULL;
mdev->upper[priv->port] = NULL; mdev->upper[priv->port] = NULL;
mutex_unlock(&mdev->state_lock);
#ifdef CONFIG_RFS_ACCEL #ifdef CONFIG_RFS_ACCEL
mlx4_en_cleanup_filters(priv); mlx4_en_cleanup_filters(priv);
#endif #endif
mlx4_en_free_resources(priv); mlx4_en_free_resources(priv);
mutex_unlock(&mdev->state_lock);
kfree(priv->tx_ring); kfree(priv->tx_ring);
kfree(priv->tx_cq); kfree(priv->tx_cq);
......
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