]> git.baikalelectronics.ru Git - kernel.git/commit
rtnetlink: add reference counting to prevent module unload while dump is in progress
authorFlorian Westphal <fw@strlen.de>
Wed, 9 Aug 2017 18:41:49 +0000 (20:41 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Aug 2017 23:57:38 +0000 (16:57 -0700)
commit8db86be056ee401019fe37ce1ed37c83241dea4c
tree3a97790600c4e1a23ffce2d9376252704a3ee5aa
parent00ea43cc49f3e1383cbcec04dbe8442319cc8381
rtnetlink: add reference counting to prevent module unload while dump is in progress

I don't see what prevents rmmod (unregister_all is called) while a dump
is active.

Even if we'd add rtnl lock/unlock pair to unregister_all (as done here),
thats not enough either as rtnl_lock is released right before the dump
process starts.

So this adds a refcount:
 * acquire rtnl mutex
 * bump refcount
 * release mutex
 * start the dump

... and make unregister_all remove the callbacks (no new dumps possible)
and then wait until refcount is 0.

Signed-off-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/rtnetlink.c