summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-05-02 15:23:28 +0200
committerLucas De Marchi <lucas.de.marchi@gmail.com>2013-05-02 23:30:44 -0300
commitc010f02030003c64faded49ee277b8903b8feb9f (patch)
tree8f87134bc709ed11f6df11701b5423ef5106a132
parent38829712e5c411bc250aeae142fc6bf06e794d58 (diff)
downloadkmod-c010f02030003c64faded49ee277b8903b8feb9f.tar.gz
modprobe: don't check refcount with remove command
The modprobe.d (5) documentation for the "install" command states that you could specify install fred /sbin/modprobe barney; /sbin/modprobe --ignore-install fred This makes some sense, but then the loading of "barney" is hidden from the user who did only "modprobe fred". Thus, it seems it should be possible to be able to unload the "fred" module with "modprobe -r fred" by configuring the "barney" module to also be removed: remove fred /sbin/rmmod barney fred (or similar.) Make this possible by not checking the refcount when an unload command was configured. Reported-by: David Spinadel <david.spinadel@intel.com>
-rw-r--r--tools/modprobe.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/modprobe.c b/tools/modprobe.c
index a053efb..6b34658 100644
--- a/tools/modprobe.c
+++ b/tools/modprobe.c
@@ -386,7 +386,7 @@ static int rmmod_do_module(struct kmod_module *mod, bool do_dependencies)
goto error;
}
- if (!ignore_loaded) {
+ if (!ignore_loaded && !cmd) {
int usage = kmod_module_get_refcnt(mod);
if (usage > 0) {