summaryrefslogtreecommitdiff
path: root/testing/kmod/fix-error-path-when-loading-deps.patch
blob: 0046d19b92ddb9fddc649154174befe89e342b2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From cb0d0b72128ac566aad9a72800c5a64af66f0b6e Mon Sep 17 00:00:00 2001
From: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Date: Sun, 8 Jan 2012 18:08:05 -0200
Subject: [PATCH] modprobe: fix error path when loading dependencies

demarchi> scenario is the following:
demarchi> modA depends on modB and modC
demarchi> if there's a race when trying to insert a dependency of a module, say
          modB, it will stop loading all the modules
demarchi> it should check by "module already loaded error"
demarchi> like it does for modA
---
 tools/kmod-modprobe.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tools/kmod-modprobe.c b/tools/kmod-modprobe.c
index eaf9346..2cda935 100644
--- a/tools/kmod-modprobe.c
+++ b/tools/kmod-modprobe.c
@@ -666,9 +666,11 @@ static int insmod_do_deps_list(struct kmod_module *parent, struct kmod_list *dep
 				flags |= KMOD_INSERT_FORCE_VERMAGIC;
 
 			r = kmod_module_insert_module(dm, flags, opts);
+			if (r == -EEXIST && !first_time)
+				r = 0;
 			if (r < 0) {
 				WRN("could not insert '%s': %s\n",
-				    dmname, strerror(-r));
+						dmname, strerror(-r));
 				goto dep_error;
 			}
 		}
-- 
1.7.8.1