diff options
author | Johannes Berg <johannes.berg@intel.com> | 2014-12-22 12:56:38 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-12-27 02:20:23 -0500 |
commit | 7d68536bed72b09de03b07479dd707c5831b3b94 (patch) | |
tree | 79b9ce734d410cd60ee83c357d042d9d39dfb7a7 /net | |
parent | b10dcb3b94010e3ac3951f68789400b1665effb1 (diff) |
netlink: call unbind when releasing socket
Currently, netlink_unbind() is only called when the socket
explicitly unbinds, which limits its usefulness (luckily
there are no users of it yet anyway.)
Call netlink_unbind() also when a socket is released, so it
becomes possible to track listeners with this callback and
without also implementing a netlink notifier (and checking
netlink_has_listeners() in there.)
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/netlink/af_netlink.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 6a9fb7c489a8..f29b63fad932 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1246,6 +1246,13 @@ static int netlink_release(struct socket *sock) | |||
1246 | netlink_table_ungrab(); | 1246 | netlink_table_ungrab(); |
1247 | } | 1247 | } |
1248 | 1248 | ||
1249 | if (nlk->netlink_unbind) { | ||
1250 | int i; | ||
1251 | |||
1252 | for (i = 0; i < nlk->ngroups; i++) | ||
1253 | if (test_bit(i, nlk->groups)) | ||
1254 | nlk->netlink_unbind(i + 1); | ||
1255 | } | ||
1249 | kfree(nlk->groups); | 1256 | kfree(nlk->groups); |
1250 | nlk->groups = NULL; | 1257 | nlk->groups = NULL; |
1251 | 1258 | ||