diff options
author | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-12-02 18:26:25 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-12-02 18:26:25 -0500 |
commit | 5c69b0ada634bca4111fcc332df5fad2447ec90f (patch) | |
tree | d54e608075292c97e54bfd182ceef061aa3fc7df /net/bluetooth/bnep | |
parent | ce7e4ad1436a0139c16225f2376134cff3ad24fe (diff) | |
parent | 33cb722c22f28964a501a56cc76397834c221c7a (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth
Diffstat (limited to 'net/bluetooth/bnep')
-rw-r--r-- | net/bluetooth/bnep/core.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index a6cd856046ab..42d53b85a808 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c | |||
@@ -77,17 +77,12 @@ static struct bnep_session *__bnep_get_session(u8 *dst) | |||
77 | 77 | ||
78 | static void __bnep_link_session(struct bnep_session *s) | 78 | static void __bnep_link_session(struct bnep_session *s) |
79 | { | 79 | { |
80 | /* It's safe to call __module_get() here because sessions are added | ||
81 | by the socket layer which has to hold the reference to this module. | ||
82 | */ | ||
83 | __module_get(THIS_MODULE); | ||
84 | list_add(&s->list, &bnep_session_list); | 80 | list_add(&s->list, &bnep_session_list); |
85 | } | 81 | } |
86 | 82 | ||
87 | static void __bnep_unlink_session(struct bnep_session *s) | 83 | static void __bnep_unlink_session(struct bnep_session *s) |
88 | { | 84 | { |
89 | list_del(&s->list); | 85 | list_del(&s->list); |
90 | module_put(THIS_MODULE); | ||
91 | } | 86 | } |
92 | 87 | ||
93 | static int bnep_send(struct bnep_session *s, void *data, size_t len) | 88 | static int bnep_send(struct bnep_session *s, void *data, size_t len) |
@@ -528,6 +523,7 @@ static int bnep_session(void *arg) | |||
528 | 523 | ||
529 | up_write(&bnep_session_sem); | 524 | up_write(&bnep_session_sem); |
530 | free_netdev(dev); | 525 | free_netdev(dev); |
526 | module_put_and_exit(0); | ||
531 | return 0; | 527 | return 0; |
532 | } | 528 | } |
533 | 529 | ||
@@ -614,9 +610,11 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) | |||
614 | 610 | ||
615 | __bnep_link_session(s); | 611 | __bnep_link_session(s); |
616 | 612 | ||
613 | __module_get(THIS_MODULE); | ||
617 | s->task = kthread_run(bnep_session, s, "kbnepd %s", dev->name); | 614 | s->task = kthread_run(bnep_session, s, "kbnepd %s", dev->name); |
618 | if (IS_ERR(s->task)) { | 615 | if (IS_ERR(s->task)) { |
619 | /* Session thread start failed, gotta cleanup. */ | 616 | /* Session thread start failed, gotta cleanup. */ |
617 | module_put(THIS_MODULE); | ||
620 | unregister_netdev(dev); | 618 | unregister_netdev(dev); |
621 | __bnep_unlink_session(s); | 619 | __bnep_unlink_session(s); |
622 | err = PTR_ERR(s->task); | 620 | err = PTR_ERR(s->task); |