| @@ -677,6 +677,7 @@ static int netlink_create(struct net *net, struct socket *sock, int protocol, · 676 unmodified lines |
| 677 | 677 | struct netlink_sock *nlk; |
| 678 | 678 | int (*bind)(struct net *net, int group); |
| 679 | 679 | void (*unbind)(struct net *net, int group); |
| 680 | + void (*release)(struct sock *sock, unsigned long *groups); |
| 680 | 681 | int err = 0; |
| 681 | 682 | |
| 682 | 683 | sock->state = SS_UNCONNECTED; |
| @@ -704,6 +705,7 @@ static int netlink_create(struct net *net, struct socket *sock, int protocol, · 21 unmodified lines |
| 704 | 705 | cb_mutex = nl_table[protocol].cb_mutex; |
| 705 | 706 | bind = nl_table[protocol].bind; |
| 706 | 707 | unbind = nl_table[protocol].unbind; |
| 708 | + release = nl_table[protocol].release; |
| 707 | 709 | netlink_unlock_table(); |
| 708 | 710 | |
| 709 | 711 | if (err < 0) |
| @@ -719,6 +721,7 @@ static int netlink_create(struct net *net, struct socket *sock, int protocol, · 9 unmodified lines |
| 719 | 721 | nlk->module = module; |
| 720 | 722 | nlk->netlink_bind = bind; |
| 721 | 723 | nlk->netlink_unbind = unbind; |
| 724 | + nlk->netlink_release = release; |
| 722 | 725 | out: |
| 723 | 726 | return err; |
| 724 | 727 | |
| @@ -763,6 +766,8 @@ static int netlink_release(struct socket *sock) · 38 unmodified lines |
| 763 | 766 | * OK. Socket is unlinked, any packets that arrive now |
| 764 | 767 | * will be purged. |
| 765 | 768 | */ |
| 769 | + if (nlk->netlink_release) |
| 770 | + nlk->netlink_release(sk, nlk->groups); |
| 766 | 771 | |
| 767 | 772 | /* must not acquire netlink_table_lock in any way again before unbind |
| 768 | 773 | * and notifying genetlink is done as otherwise it might deadlock |
| @@ -2089,6 +2094,7 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module, · 1320 unmodified lines |
| 2089 | 2094 | if (cfg) { |
| 2090 | 2095 | nl_table[unit].bind = cfg->bind; |
| 2091 | 2096 | nl_table[unit].unbind = cfg->unbind; |
| 2097 | + nl_table[unit].release = cfg->release; |
| 2092 | 2098 | nl_table[unit].flags = cfg->flags; |
| 2093 | 2099 | } |
| 2094 | 2100 | nl_table[unit].registered = 1; |