summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2025-03-24 15:45:27 -0700
committerJakub Kicinski <kuba@kernel.org>2025-03-25 10:04:49 -0700
commitba6f418fbf64bb8c0e98dc1b548c151beeedd16c (patch)
treec9fb33b6c07d3e021fef35e564cbb279e1276c2a
parent51068769cc8c699eaba7d411f214bc969b35708b (diff)
downloadlinux-ba6f418fbf64bb8c0e98dc1b548c151beeedd16c.tar.gz
linux-ba6f418fbf64bb8c0e98dc1b548c151beeedd16c.tar.bz2
linux-ba6f418fbf64bb8c0e98dc1b548c151beeedd16c.zip
net: bubble up taking netdev instance lock to callers of net_devmem_unbind_dmabuf()
A recent commit added taking the netdev instance lock in netdev_nl_bind_rx_doit(), but didn't remove it in net_devmem_unbind_dmabuf() which it calls from an error path. Always expect the callers of net_devmem_unbind_dmabuf() to hold the lock. This is consistent with net_devmem_bind_dmabuf(). (Not so) coincidentally this also protects mp_param with the instance lock, which the rest of this series needs. Fixes: 1d22d3060b9b ("net: drop rtnl_lock for queue_mgmt operations") Reviewed-by: Mina Almasry <almasrymina@google.com> Acked-by: Stanislav Fomichev <sdf@fomichev.me> Link: https://patch.msgid.link/20250324224537.248800-2-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--net/core/devmem.c2
-rw-r--r--net/core/netdev-genl.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/net/core/devmem.c b/net/core/devmem.c
index 6802e82a4d03..ee145a2aa41c 100644
--- a/net/core/devmem.c
+++ b/net/core/devmem.c
@@ -128,12 +128,10 @@ void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding)
rxq->mp_params.mp_priv = NULL;
rxq->mp_params.mp_ops = NULL;
- netdev_lock(binding->dev);
rxq_idx = get_netdev_rx_queue_index(rxq);
err = netdev_rx_queue_restart(binding->dev, rxq_idx);
WARN_ON(err && err != -ENETDOWN);
- netdev_unlock(binding->dev);
}
xa_erase(&net_devmem_dmabuf_bindings, binding->id);
diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
index a186fea63c09..9e4882a22407 100644
--- a/net/core/netdev-genl.c
+++ b/net/core/netdev-genl.c
@@ -947,7 +947,9 @@ void netdev_nl_sock_priv_destroy(struct netdev_nl_sock *priv)
mutex_lock(&priv->lock);
list_for_each_entry_safe(binding, temp, &priv->bindings, list) {
+ netdev_lock(binding->dev);
net_devmem_unbind_dmabuf(binding);
+ netdev_unlock(binding->dev);
}
mutex_unlock(&priv->lock);
}