summaryrefslogtreecommitdiff
path: root/core/kmod/0002-depmod-fix-asserting-mod-kmod-NULL.patch
blob: b704083dce66e4d422f616072e15eb66b0d582ac (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
From 02c64df3c2b33880b18d3f4aba9fa8e48e5ca904 Mon Sep 17 00:00:00 2001
From: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Date: Fri, 16 Nov 2012 12:05:42 -0200
Subject: [PATCH 2/2] depmod: fix asserting mod->kmod == NULL

If we are replacing a lower priority module (due to its location), we
already created a kmod_module, but didn't open the file for reading its
symbols. This means mod->kmod won't be NULL, and this is just ok. Since
all the functions freeing stuff below the previous assert already takes
NULL into consideration, it's safe to just unref mod->kmod and let the
right thing happens.
---
 tools/depmod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/depmod.c b/tools/depmod.c
index aafe66b..7bbdcd3 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -977,7 +977,7 @@ static void mod_free(struct mod *mod)
 {
 	DBG("free %p kmod=%p, path=%s\n", mod, mod->kmod, mod->path);
 	array_free_array(&mod->deps);
-	assert(mod->kmod == NULL);
+	kmod_module_unref(mod->kmod);
 	kmod_module_info_free_list(mod->info_list);
 	kmod_module_dependency_symbols_free_list(mod->dep_sym_list);
 	free(mod->uncrelpath);
-- 
1.8.0