aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/netdev-genl.c
diff options
context:
space:
mode:
authorJakub Kicinski <[email protected]>2025-05-15 18:22:32 +0000
committerJakub Kicinski <[email protected]>2025-05-15 18:28:30 +0000
commitbebd7b262638af611a0e699ba37c43ec2238801b (patch)
tree361c8116078d4923b630a5bff78614d136ba5716 /net/core/netdev-genl.c
parentnet: prestera: Use to_delayed_work() (diff)
parentMerge tag 'net-6.15-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/net... (diff)
downloadkernel-bebd7b262638af611a0e699ba37c43ec2238801b.tar.gz
kernel-bebd7b262638af611a0e699ba37c43ec2238801b.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Cross-merge networking fixes after downstream PR (net-6.15-rc7). Conflicts: tools/testing/selftests/drivers/net/hw/ncdevmem.c 97c4e094a4b2 ("tests/ncdevmem: Fix double-free of queue array") 2f1a805f32ba ("selftests: ncdevmem: Implement devmem TCP TX") https://lore.kernel.org/[email protected] Adjacent changes: net/core/devmem.c net/core/devmem.h 0afc44d8cdf6 ("net: devmem: fix kernel panic when netlink socket close after module unload") bd61848900bf ("net: devmem: Implement TX path") Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'net/core/netdev-genl.c')
-rw-r--r--net/core/netdev-genl.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
index cfcf1654d4fb..762570dcda61 100644
--- a/net/core/netdev-genl.c
+++ b/net/core/netdev-genl.c
@@ -1056,14 +1056,25 @@ void netdev_nl_sock_priv_destroy(struct netdev_nl_sock *priv)
{
struct net_devmem_dmabuf_binding *binding;
struct net_devmem_dmabuf_binding *temp;
+ netdevice_tracker dev_tracker;
struct net_device *dev;
mutex_lock(&priv->lock);
list_for_each_entry_safe(binding, temp, &priv->bindings, list) {
+ mutex_lock(&binding->lock);
dev = binding->dev;
+ if (!dev) {
+ mutex_unlock(&binding->lock);
+ net_devmem_unbind_dmabuf(binding);
+ continue;
+ }
+ netdev_hold(dev, &dev_tracker, GFP_KERNEL);
+ mutex_unlock(&binding->lock);
+
netdev_lock(dev);
net_devmem_unbind_dmabuf(binding);
netdev_unlock(dev);
+ netdev_put(dev, &dev_tracker);
}
mutex_unlock(&priv->lock);
}