Skip to contentSkip to conversation

kernel/module: improve documentation for try_module_get()

PATCH In review Marco Pagani 2 participants 2 messages Dec 21, 2023 Module support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel/module: improve documentation for try_module_get()

The sentence "this call will fail if the module is already being removed" is potentially confusing and may contradict the rest of the documentation. If one tries to get a module that has already been removed using a stale pointer, the kernel will crash.

---
 include/linux/module.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/module.h +1 -1
index a98e188cf37b..08364d5cbc07 100644
@@ -668,7 +668,7 @@ extern void __module_get(struct module *module);
  * @module: the module we should check for
  *
  * Only try to get a module reference count if the module is not being removed.
- * This call will fail if the module is already being removed.
+ * This call will fail if the module is in the process of being removed.
  *
  * Care must also be taken to ensure the module exists and is alive prior to
  * usage of this call. This can be gauranteed through two means:
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 6 lines · Marco Pagani

The sentence "this call will fail if the module is already being removed" is potentially confusing and may contradict the rest of the documentation. If one tries to get a module that has already been removed using a stale pointer, the kernel will crash.

Thanks, patch applied!

Luis