From: Gustavo Padovan <padovan@profusion.mobi>
To: David Herrmann <dh.herrmann@googlemail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: hidp: Fix module reference cleanup
Date: Tue, 1 Nov 2011 15:25:11 -0200 [thread overview]
Message-ID: <20111101172511.GM2580@joana> (raw)
In-Reply-To: <1320164870-13797-1-git-send-email-dh.herrmann@googlemail.com>
Hi David,
* David Herrmann <dh.herrmann@googlemail.com> [2011-11-01 17:27:50 +0100]:
> Calling module_put(THIS_MODULE) is *never* safe when we cannot go sure that we
> own at least two references. This is because the call may unload our module
> before it returns and then the "return" will jump into invalid memory.
>
> Gladly, module.h provides a wrapper for kthread-users: module_put_and_exit().
> This puts our module and then exits the kthread without returning to the module.
>
> This patch fixes the hidp kthread to use this wrapper instead of manually
> freeing its own reference. See nfsd or lockd for other kthreads using this.
>
> Calling __module_get() inside the kthread is safe as the hidp module will always
> wait until the kthread sets "waiting_for_startup" to 0.
>
> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
> ---
> V3: I rebased on top of bluetooth-next plus the patches already pending on the
> ML. It should apply cleanly now. Otherwise, just tell me what tree to use for
> the rebase ;) Or try "git am -3 ..."
>
> net/bluetooth/hidp/core.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Gustavo
prev parent reply other threads:[~2011-11-01 17:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-29 20:34 [PATCH] Bluetooth: hidp: Fix module reference cleanup David Herrmann
2011-10-30 14:26 ` Anderson Lizardo
2011-10-30 14:33 ` [PATCH v2] " David Herrmann
2011-11-01 16:12 ` Gustavo Padovan
2011-11-01 16:27 ` [PATCH] " David Herrmann
2011-11-01 17:25 ` Gustavo Padovan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111101172511.GM2580@joana \
--to=padovan@profusion.mobi \
--cc=dh.herrmann@googlemail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.