Should modprobe blacklist all or only canned aliases?

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

 



According to manual page for modprobe.conf(5), only canned aliases taken 
from kernel modules are blacklisted:

    Modules can contain their own aliases: usually these are aliases
    describing the devices they support, such as "pci:123...". These
    "internal" aliases can be overridden by normal "alias" keywords,
    but there are cases where two or more modules both  support  the
    same  devices,  or a module invalidly claims to support a device
    that it does not: the blacklist keyword indicates  that  all  of
    that particular module's internal aliases are to be ignored.

But as written now, modprobe applies blacklist to all modules, both read 
from configuration files as well as from modules.alias.

Should not it actually do as in the attached patch? This patch is from 
Mandriva package adapted to current version; second apply_blacklist is 
to make sure alias ordering is the same for all cases.
Subject: [PATCH] Do not blacklist aliases read from configuration files
From: Andrey Borzenkov <arvidjaar@xxxxxxx>

Modprobe.conf manual states that blacklist keyword blacklists only
canned aliases. Currently blacklist is applied to all aliases, both
from configuration files as well as kernel modules.alias. Make sure
only latter are blacklisted.

Signed-off-by: Andrey Borzenkov <arvidjaar@xxxxxxx>

---

 modprobe.c |   60 ++++++++++++++++++++++++++++++++----------------------------
 1 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/modprobe.c b/modprobe.c
index 26a7163..ef463b3 100644
--- a/modprobe.c
+++ b/modprobe.c
@@ -1594,39 +1594,43 @@ int do_modprobe(const char *modname,
 	matching_aliases = find_aliases(conf->aliases, modname);
 
 	/* No luck?  Try symbol names, if starts with symbol:. */
-	if (!matching_aliases && strstarts(modname, "symbol:")) {
-		char *symfilename;
-
-		nofail_asprintf(&symfilename, "%s/modules.symbols", dirname);
-		read_aliases(symfilename, modname, 0, &matching_aliases);
-		free(symfilename);
-	}
 	if (!matching_aliases) {
-		if(!strchr(modname, ':'))
-			read_depends(dirname, modname, &list);
+		if (strstarts(modname, "symbol:")) {
+			char *symfilename;
 
-		/* We only use canned aliases as last resort. */
-		if (list_empty(&list)
-		    && !find_softdep(modname, conf->softdeps)
-		    && !find_command(modname, conf->commands))
-		{
-			char *aliasfilename;
-
-			nofail_asprintf(&aliasfilename, "%s/modules.alias",
-					dirname);
-			read_aliases(aliasfilename, modname, 0,
-				     &matching_aliases);
-			free(aliasfilename);
-			/* builtin module? */
-			if (!matching_aliases && module_builtin(dirname, modname) > 0) {
-				failed |= handle_builtin_module(modname, error,
-								flags);
-				goto out;
+			nofail_asprintf(&symfilename, "%s/modules.symbols", dirname);
+			read_aliases(symfilename, modname, 0, &matching_aliases);
+			free(symfilename);
+		}
+		if (!matching_aliases) {
+			if(!strchr(modname, ':'))
+				read_depends(dirname, modname, &list);
+
+			/* We only use canned aliases as last resort. */
+			if (list_empty(&list)
+			    && !find_softdep(modname, conf->softdeps)
+			    && !find_command(modname, conf->commands))
+			{
+				char *aliasfilename;
+
+				nofail_asprintf(&aliasfilename, "%s/modules.alias",
+						dirname);
+				read_aliases(aliasfilename, modname, 0,
+					     &matching_aliases);
+				free(aliasfilename);
+				/* builtin module? */
+				if (!matching_aliases && module_builtin(dirname, modname) > 0) {
+					failed |= handle_builtin_module(modname, error,
+									flags);
+					goto out;
+				}
 			}
 		}
-	}
 
-	apply_blacklist(&matching_aliases, conf->blacklist);
+		apply_blacklist(&matching_aliases, conf->blacklist);
+	} else
+		apply_blacklist(&matching_aliases, NULL); /* Reverses the list */
+
 	if(flags & mit_resolve_alias) {
 		struct module_alias *aliases = matching_aliases;
 

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux