diff options
author | Krzysztof Mazur <krzysiek@podlesie.net> | 2012-11-06 17:16:57 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-11-27 19:36:48 -0500 |
commit | ec809bd817dfa1905283468e4c813684ed4efe78 (patch) | |
tree | 6e13787ae7a88c73316e91f02b8116cc93309752 /net/atm/common.c | |
parent | ae088d663beebb3cad0e7abaac67ee61a7c578d5 (diff) |
atm: add owner of push() callback to atmvcc
The atm is using atmvcc->push(vcc, NULL) callback to notify protocol
that vcc will be closed and protocol must detach from it. This callback
is usually used by protocol to decrement module usage count by module_put(),
but it leaves small window then module is still used after module_put().
Now the owner of push() callback is kept in atmvcc and
module_put(atmvcc->owner) is called after the protocol is detached from vcc.
Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Chas Williams <chas@cmf.nrl.navy.mil>
Diffstat (limited to 'net/atm/common.c')
-rw-r--r-- | net/atm/common.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/atm/common.c b/net/atm/common.c index 0c0ad930a632..24216642d696 100644 --- a/net/atm/common.c +++ b/net/atm/common.c | |||
@@ -156,6 +156,7 @@ int vcc_create(struct net *net, struct socket *sock, int protocol, int family) | |||
156 | atomic_set(&sk->sk_rmem_alloc, 0); | 156 | atomic_set(&sk->sk_rmem_alloc, 0); |
157 | vcc->push = NULL; | 157 | vcc->push = NULL; |
158 | vcc->pop = NULL; | 158 | vcc->pop = NULL; |
159 | vcc->owner = NULL; | ||
159 | vcc->push_oam = NULL; | 160 | vcc->push_oam = NULL; |
160 | vcc->vpi = vcc->vci = 0; /* no VCI/VPI yet */ | 161 | vcc->vpi = vcc->vci = 0; /* no VCI/VPI yet */ |
161 | vcc->atm_options = vcc->aal_options = 0; | 162 | vcc->atm_options = vcc->aal_options = 0; |
@@ -175,6 +176,7 @@ static void vcc_destroy_socket(struct sock *sk) | |||
175 | vcc->dev->ops->close(vcc); | 176 | vcc->dev->ops->close(vcc); |
176 | if (vcc->push) | 177 | if (vcc->push) |
177 | vcc->push(vcc, NULL); /* atmarpd has no push */ | 178 | vcc->push(vcc, NULL); /* atmarpd has no push */ |
179 | module_put(vcc->owner); | ||
178 | 180 | ||
179 | while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { | 181 | while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { |
180 | atm_return(vcc, skb->truesize); | 182 | atm_return(vcc, skb->truesize); |