diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-09-22 03:43:05 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-09-22 03:43:05 -0400 |
commit | 6e2144b76840be09924de1626e2dcd7b315f75b3 (patch) | |
tree | 33044cb63f368270229e2b40aa2ad024325c7e8b /net/llc/af_llc.c | |
parent | 04e4223f44b89e50f275cb6b95a58ebe2c4909be (diff) |
[LLC]: Use refcounting with struct llc_sap
Signed-off-by: Jochen Friedrich <jochen@scram.de>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/llc/af_llc.c')
-rw-r--r-- | net/llc/af_llc.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index ad9aad807aa8..a75b8f2aab19 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c | |||
@@ -21,6 +21,7 @@ | |||
21 | * See the GNU General Public License for more details. | 21 | * See the GNU General Public License for more details. |
22 | */ | 22 | */ |
23 | #include <linux/config.h> | 23 | #include <linux/config.h> |
24 | #include <linux/compiler.h> | ||
24 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
25 | #include <linux/module.h> | 26 | #include <linux/module.h> |
26 | #include <linux/rtnetlink.h> | 27 | #include <linux/rtnetlink.h> |
@@ -188,10 +189,6 @@ static int llc_ui_release(struct socket *sock) | |||
188 | if (!sock_flag(sk, SOCK_ZAPPED)) | 189 | if (!sock_flag(sk, SOCK_ZAPPED)) |
189 | llc_sap_remove_socket(llc->sap, sk); | 190 | llc_sap_remove_socket(llc->sap, sk); |
190 | release_sock(sk); | 191 | release_sock(sk); |
191 | if (llc->sap && hlist_empty(&llc->sap->sk_list.list)) { | ||
192 | llc_release_sockets(llc->sap); | ||
193 | llc_sap_close(llc->sap); | ||
194 | } | ||
195 | if (llc->dev) | 192 | if (llc->dev) |
196 | dev_put(llc->dev); | 193 | dev_put(llc->dev); |
197 | sock_put(sk); | 194 | sock_put(sk); |
@@ -220,6 +217,7 @@ static int llc_ui_autoport(void) | |||
220 | llc_ui_sap_last_autoport = i + 2; | 217 | llc_ui_sap_last_autoport = i + 2; |
221 | goto out; | 218 | goto out; |
222 | } | 219 | } |
220 | llc_sap_put(sap); | ||
223 | } | 221 | } |
224 | llc_ui_sap_last_autoport = LLC_SAP_DYN_START; | 222 | llc_ui_sap_last_autoport = LLC_SAP_DYN_START; |
225 | tries++; | 223 | tries++; |
@@ -310,6 +308,7 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) | |||
310 | rc = -EBUSY; /* some other network layer is using the sap */ | 308 | rc = -EBUSY; /* some other network layer is using the sap */ |
311 | if (!sap) | 309 | if (!sap) |
312 | goto out; | 310 | goto out; |
311 | llc_sap_hold(sap); | ||
313 | } else { | 312 | } else { |
314 | struct llc_addr laddr, daddr; | 313 | struct llc_addr laddr, daddr; |
315 | struct sock *ask; | 314 | struct sock *ask; |
@@ -326,7 +325,7 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) | |||
326 | ask = llc_lookup_established(sap, &daddr, &laddr); | 325 | ask = llc_lookup_established(sap, &daddr, &laddr); |
327 | if (ask) { | 326 | if (ask) { |
328 | sock_put(ask); | 327 | sock_put(ask); |
329 | goto out; | 328 | goto out_put; |
330 | } | 329 | } |
331 | } | 330 | } |
332 | llc->laddr.lsap = addr->sllc_sap; | 331 | llc->laddr.lsap = addr->sllc_sap; |
@@ -336,6 +335,8 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) | |||
336 | llc_sap_add_socket(sap, sk); | 335 | llc_sap_add_socket(sap, sk); |
337 | sock_reset_flag(sk, SOCK_ZAPPED); | 336 | sock_reset_flag(sk, SOCK_ZAPPED); |
338 | rc = 0; | 337 | rc = 0; |
338 | out_put: | ||
339 | llc_sap_put(sap); | ||
339 | out: | 340 | out: |
340 | return rc; | 341 | return rc; |
341 | } | 342 | } |