Browse code

Fix error code in kmod

Change-Id: I9df1e732b798c081bbfabbd0f20f2a2bcc3890ff
Reviewed-on: http://photon-jenkins.eng.vmware.com/745
Tested-by: jenkins-photon <wangnan2015@hotmail.com>
Reviewed-by: suezzelur <anishs@vmware.com>

suezzelur authored on 2016/04/22 11:27:28
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,31 @@
0
+From 114ec87c85c35a2bd3682f9f891e494127be6fb5 Mon Sep 17 00:00:00 2001
1
+From: Lucas De Marchi <lucas.demarchi@intel.com>
2
+Date: Sat, 13 Jun 2015 18:29:47 -0300
3
+Subject: libkmod-module: fix return code in error path
4
+
5
+ENOSYS is the wrong errno to return when we don't find a module in
6
+kmod_module_insert_module(). Why is it there in the first place?  This
7
+goes back to kmod v1 when we couldn't load modules by names, but we
8
+should give a path instead.
9
+
10
+708624a ("ELF: initial support for modinfo and strip of modversions and
11
+vermagic.") changed that so we do a lazy-search by the module path in
12
+this function. Later  f304afe ("Change error message to reflect
13
+reality") fixed the log message but the return coded remained the same.
14
+---
15
+ libkmod/libkmod-module.c | 2 +-
16
+ 1 file changed, 1 insertion(+), 1 deletion(-)
17
+
18
+diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
19
+index 366308f..50b2ff9 100644
20
+--- a/libkmod/libkmod-module.c
21
+@@ -830,7 +830,7 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
22
+ 	path = kmod_module_get_path(mod);
23
+ 	if (path == NULL) {
24
+ 		ERR(mod->ctx, "could not find module by name='%s'\n", mod->name);
25
+-		return -ENOSYS;
26
++		return -ENOENT;
27
+ 	}
28
+ 
29
+ 	mod->file = kmod_file_open(mod->ctx, path);
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Utilities for loading kernel modules
2 2
 Name:		kmod
3 3
 Version:	21
4
-Release:	2%{?dist}
4
+Release:	3%{?dist}
5 5
 License:	GPLv2+
6 6
 URL:		http://www.kernel.org/pub/linux/utils/kernel/kmod
7 7
 Group:		Applications/System
... ...
@@ -9,12 +9,14 @@ Vendor:		VMware, Inc.
9 9
 Distribution:	Photon
10 10
 Source0:	http://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.tar.xz
11 11
 %define sha1 kmod=b2c1a0a1f2979fd29c7b0825ed19254c332246b4
12
+Patch0:         kmod-21-fix-return-error-code.patch
12 13
 BuildRequires:	xz-devel
13 14
 Requires:	xz
14 15
 %description
15 16
 The Kmod package contains libraries and utilities for loading kernel modules
16 17
 %prep
17 18
 %setup -q
19
+%patch0 -p1
18 20
 %build
19 21
 ./configure \
20 22
 	--prefix=%{_prefix} \
... ...
@@ -47,6 +49,8 @@ make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}
47 47
 %{_includedir}/*
48 48
 %{_datadir}/bash-completion/completions/kmod
49 49
 %changelog
50
+*   Wed Apr 21 2016 Anish Swaminathan <anishs@vmware.com> 21-3
51
+-   Add patch for return code fix in error path
50 52
 *   Fri Mar 25 2016 Alexey Makhalov <amakhalov@vmware.com> 21-2
51 53
 -   /bin/lsmod -> /sbin/lsmod
52 54
 *   Wed Jan 13 2016 Xiaolin Li <xiaolinl@vmware.com> 21-1