Skip to content

Commit ba6f418

Browse files
committed
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: 1d22d30 ("net: drop rtnl_lock for queue_mgmt operations") Reviewed-by: Mina Almasry <[email protected]> Acked-by: Stanislav Fomichev <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5106876 commit ba6f418

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

net/core/devmem.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,10 @@ void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding)
128128
rxq->mp_params.mp_priv = NULL;
129129
rxq->mp_params.mp_ops = NULL;
130130

131-
netdev_lock(binding->dev);
132131
rxq_idx = get_netdev_rx_queue_index(rxq);
133132

134133
err = netdev_rx_queue_restart(binding->dev, rxq_idx);
135134
WARN_ON(err && err != -ENETDOWN);
136-
netdev_unlock(binding->dev);
137135
}
138136

139137
xa_erase(&net_devmem_dmabuf_bindings, binding->id);

net/core/netdev-genl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,9 @@ void netdev_nl_sock_priv_destroy(struct netdev_nl_sock *priv)
947947

948948
mutex_lock(&priv->lock);
949949
list_for_each_entry_safe(binding, temp, &priv->bindings, list) {
950+
netdev_lock(binding->dev);
950951
net_devmem_unbind_dmabuf(binding);
952+
netdev_unlock(binding->dev);
951953
}
952954
mutex_unlock(&priv->lock);
953955
}

0 commit comments

Comments
 (0)