diff options
author | Hauke Mehrtens <hauke@openwrt.org> | 2011-06-15 21:17:52 +0000 |
---|---|---|
committer | Hauke Mehrtens <hauke@openwrt.org> | 2011-06-15 21:17:52 +0000 |
commit | 39df8cbac18d93e110ad9164b640d87c905b1de2 (patch) | |
tree | fbb00098ff31d5828e496b4ab99f73a3fbc44ff1 | |
parent | 9893a55a4c9b58337e5804dbcf3831af5c68b733 (diff) | |
download | master-187ad058-39df8cbac18d93e110ad9164b640d87c905b1de2.tar.gz master-187ad058-39df8cbac18d93e110ad9164b640d87c905b1de2.tar.bz2 master-187ad058-39df8cbac18d93e110ad9164b640d87c905b1de2.zip |
busybox: Fix insmod for linux 3.0
Insmod silently rejected being run on any non 2.x kernel. Make its version
check allow newer kernels (and reject 2.4- when not enabling the 2.4
feature).
Signed-off-by: Jonas Gorski <jonas.gorski+openwrt@gmail.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@27189 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r-- | package/busybox/patches/470-insmod_search.patch | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/package/busybox/patches/470-insmod_search.patch b/package/busybox/patches/470-insmod_search.patch index 8c5741d17f..b5314e3f0d 100644 --- a/package/busybox/patches/470-insmod_search.patch +++ b/package/busybox/patches/470-insmod_search.patch @@ -1,6 +1,6 @@ --- a/modutils/insmod.c +++ b/modutils/insmod.c -@@ -11,6 +11,99 @@ +@@ -11,6 +11,106 @@ #include "libbb.h" #include "modutils.h" @@ -37,20 +37,27 @@ + char *module_dir, real_module_dir[FILENAME_MAX]; + int len, slen, ret = ENOENT, k_version; + struct utsname myuname; -+ const char *suffix; ++ const char *suffix = ".ko"; + struct stat st; + + /* check the kernel version */ -+ if ((uname(&myuname) != 0) || (myuname.release[0] != '2')) ++ if (uname(&myuname) != 0) + return EINVAL; + -+ k_version = myuname.release[2] - '0'; ++ k_version = myuname.release[0] - '0'; ++ ++ if (k_version < 2 || k_version > 9) ++ return EINVAL; ++ ++ if (k_version == 2) { ++ int k_patchlevel = myuname.release[2] - '0'; ++ if (k_patchlevel <= 4) +#if ENABLE_FEATURE_2_4_MODULES -+ if (k_version <= 4) -+ suffix = ".o"; -+ else ++ suffix = ".o"; ++#else ++ return EINVAL; +#endif -+ suffix = ".ko"; ++ } + + len = strlen(filename); + slen = strlen(suffix); @@ -100,7 +107,7 @@ /* 2.6 style insmod has no options and required filename * (not module name - .ko can't be omitted) */ -@@ -59,9 +152,15 @@ int insmod_main(int argc UNUSED_PARAM, c +@@ -59,9 +159,15 @@ int insmod_main(int argc UNUSED_PARAM, c if (!filename) bb_show_usage(); |