linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] depmod: do not allow partial matches with "search" directive
@ 2014-03-18 23:26 Anssi Hannula
  2014-03-18 23:26 ` [PATCH 2/2] depmod: fix debug print parameter order Anssi Hannula
  2014-03-19 12:24 ` [PATCH 1/2] depmod: do not allow partial matches with "search" directive Lucas De Marchi
  0 siblings, 2 replies; 7+ messages in thread
From: Anssi Hannula @ 2014-03-18 23:26 UTC (permalink / raw)
  To: linux-modules

Currently e.g. "search foo foobar built-in" will cause unpredictable
results if baz.ko is in both foo/ and foobar/, since "foo" in search may
match both of those directories and the preferred module therefore
depends on processing order.

Fix the code to ensure that the match is performed on full pathname
components only.
---
 tools/depmod.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/depmod.c b/tools/depmod.c
index 9f83ee8..328e578 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -1153,10 +1153,10 @@ static int depmod_module_is_higher_priority(const struct depmod *depmod, const s
 		DBG("search %s\n", se->builtin ? "built-in" : se->path);
 		if (se->builtin)
 			bprio = i;
-		else if (newlen >= se->len &&
+		else if (newlen > se->len && newpath[se->len] == '/' &&
 			 memcmp(se->path, newpath, se->len) == 0)
 			newprio = i;
-		else if (oldlen >= se->len &&
+		else if (oldlen > se->len && oldpath[se->len] == '/' &&
 			 memcmp(se->path, oldpath, se->len) == 0)
 			oldprio = i;
 	}
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-03-20  2:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-18 23:26 [PATCH 1/2] depmod: do not allow partial matches with "search" directive Anssi Hannula
2014-03-18 23:26 ` [PATCH 2/2] depmod: fix debug print parameter order Anssi Hannula
2014-03-19 12:24 ` [PATCH 1/2] depmod: do not allow partial matches with "search" directive Lucas De Marchi
2014-03-19 21:12   ` Anssi Hannula
2014-03-19 21:22     ` Lucas De Marchi
2014-03-19 21:50       ` Anssi Hannula
2014-03-20  2:47         ` Lucas De Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).