Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1221038 > unrolled thread
| Started by | Rusty Russell <rusty@rustcorp.com.au> |
|---|---|
| First post | 2015-09-08 20:50 +0200 |
| Last post | 2015-09-08 20:50 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: module_put_and_exit() and free_module() Rusty Russell <rusty@rustcorp.com.au> - 2015-09-08 20:50 +0200
| From | Rusty Russell <rusty@rustcorp.com.au> |
|---|---|
| Date | 2015-09-08 20:50 +0200 |
| Subject | Re: module_put_and_exit() and free_module() |
| Message-ID | <q6w7T-4dc-13@gated-at.bofh.it> |
Aleksa Sarai <cyphar@cyphar.com> writes: >>From my understanding, module_put_and_exit() can be used inside a > module to (from within the module) kill itself. However, it doesn't > seem to properly free the modules references (and internal > bookkeeping) since module_put_and_exit() doesn't call free_module(). > And attempting to remove the module after loading it and it running > module_put_and_exit() causes any attempt to remove the module to fail > with EBUSY. It's not a general mechanism! It's for kernel threads which want to decrement module use counts as they exit: if they did this in the module there would be a moment where they are still running but the module could be unloaded. > Am I missing something here? Is the purpose of module_put_and_exit() > different, or does module_put() cause the module references to get > reaped later? If that's the case, why do you get EBUSY when trying to > remove the module (surely you should get an ENOENT)? Is it even safe > to attempt to remove a module from within itself? module_put() simply controls the reference count. Module removal only succeeds if the reference count is 0. I would guess that you called module_put_and_exit() without a thread, and oopsed. Cheers, Rusty. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to top | Article view | linux.kernel
csiph-web