summaryrefslogtreecommitdiff
path: root/net/netlink
diff options
context:
space:
mode:
authorRichard Guy Briggs <rgb@redhat.com>2014-04-23 05:31:55 +0400
committerDavid S. Miller <davem@davemloft.net>2014-04-23 05:42:26 +0400
commit7774d5e03f4a41ec7c1e736acc108f112003bb4a (patch)
treed8f3f9db89b1660d79491885d0f757c95a582414 /net/netlink
parent4f520900522fd596e336c07e9aafd5b7a9564235 (diff)
downloadlinux-7774d5e03f4a41ec7c1e736acc108f112003bb4a.tar.xz
netlink: implement unbind to netlink_setsockopt NETLINK_DROP_MEMBERSHIP
Call the per-protocol unbind function rather than bind function on NETLINK_DROP_MEMBERSHIP in netlink_setsockopt(). Signed-off-by: Richard Guy Briggs <rgb@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink')
-rw-r--r--net/netlink/af_netlink.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 7e8d229bc010..92f4b6915e89 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2129,7 +2129,7 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname,
return err;
if (!val || val - 1 >= nlk->ngroups)
return -EINVAL;
- if (nlk->netlink_bind) {
+ if (optname == NETLINK_ADD_MEMBERSHIP && nlk->netlink_bind) {
err = nlk->netlink_bind(val);
if (err)
return err;
@@ -2138,6 +2138,8 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname,
netlink_update_socket_mc(nlk, val,
optname == NETLINK_ADD_MEMBERSHIP);
netlink_table_ungrab();
+ if (optname == NETLINK_DROP_MEMBERSHIP && nlk->netlink_unbind)
+ nlk->netlink_unbind(val);
err = 0;
break;