Re: [PATCH v2] Bluetooth: hidp: Fix module reference cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi David,

* David Herrmann <dh.herrmann@xxxxxxxxxxxxxx> [2011-10-30 15:33:43 +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.
> 
> Signed-off-by: David Herrmann <dh.herrmann@xxxxxxxxxxxxxx>
> ---
> V2: Fix error path of kthread_run(). We now take the module reference inside the
> kthread. This is safe because the caller will wait for us until we set
> "waiting_for_startup" to 0. Thanks to Anderson Lizardo for pointing this out.
> 
>  net/bluetooth/hidp/core.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

This one doesn't apply anymore, please rebase. Thanks.

	Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux