diff options
author | Eric Dumazet <edumazet@google.com> | 2022-07-29 09:12:32 +0000 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-08-01 11:59:23 -0700 |
commit | 931027820e4dafabc78aff82af59f8c1c4bd3128 (patch) | |
tree | 2ec2f883b9d11050ef6f01a59b0747b761f565c6 /net/rose/rose_route.c | |
parent | 9936e07eaf5b764ff36c5677644bb5d556fb7e45 (diff) | |
download | lwn-931027820e4dafabc78aff82af59f8c1c4bd3128.tar.gz lwn-931027820e4dafabc78aff82af59f8c1c4bd3128.zip |
net: rose: fix netdev reference changes
Bernard reported that trying to unload rose module would lead
to infamous messages:
unregistered_netdevice: waiting for rose0 to become free. Usage count = xx
This patch solves the issue, by making sure each socket referring to
a netdevice holds a reference count on it, and properly releases it
in rose_release().
rose_dev_first() is also fixed to take a device reference
before leaving the rcu_read_locked section.
Following patch will add ref_tracker annotations to ease
future bug hunting.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Bernard Pidoux <f6bvp@free.fr>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Tested-by: Bernard Pidoux <f6bvp@free.fr>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/rose/rose_route.c')
-rw-r--r-- | net/rose/rose_route.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c index eb0b8197ac82..fee772b4637c 100644 --- a/net/rose/rose_route.c +++ b/net/rose/rose_route.c @@ -615,6 +615,8 @@ struct net_device *rose_dev_first(void) if (first == NULL || strncmp(dev->name, first->name, 3) < 0) first = dev; } + if (first) + dev_hold(first); rcu_read_unlock(); return first; |