Skip to contentSkip to conversation

Don't ignore try_stop_module return

PATCH New Rusty Russell 1 participant 1 message Nov 2, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Don't ignore try_stop_module return

Name: Fix Module Removal Bug: Don't Ignore try_stop_module Return
Status: Trivial

Since 2.6.4 we've been ignoring the failure of try_stop_module: it will normally fail if the module reference count is non-zero. This would have been mainly unnoticed, since "modprobe -r" checks the usage count before calling sys_delete_module(), however there is a race which would cause a hang in this case.

kernel/module.c +2 -0
Index: linux-2.6.10-rc1-bk10-Module/kernel/module.c
===================================================================
@@ -576,6 +576,8 @@
 
 	/* Stop the machine so refcounts can't move and disable module. */
 	ret = try_stop_module(mod, flags, &forced);
+	if (ret != 0)
+		goto out;
 
 	/* Never wait if forced. */
 	if (!forced && module_refcount(mod) != 0)
Signature · 1 line
A bad analogy is like a leaky screwdriver -- Richard Braakman