Changeset 27189


Ignore:
Timestamp:
2011-06-15T23:17:52+02:00 (7 years ago)
Author:
hauke
Message:

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@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/busybox/patches/470-insmod_search.patch

    r26738 r27189  
    11--- a/modutils/insmod.c 
    22+++ b/modutils/insmod.c 
    3 @@ -11,6 +11,99 @@ 
     3@@ -11,6 +11,106 @@ 
    44  
    55 #include "libbb.h" 
     
    3838+       int len, slen, ret = ENOENT, k_version; 
    3939+       struct utsname myuname; 
    40 +       const char *suffix; 
     40+       const char *suffix = ".ko"; 
    4141+       struct stat st; 
    4242+ 
    4343+       /* check the kernel version */ 
    44 +       if ((uname(&myuname) != 0) || (myuname.release[0] != '2')) 
     44+       if (uname(&myuname) != 0) 
    4545+               return EINVAL; 
    4646+ 
    47 +       k_version = myuname.release[2] - '0'; 
     47+       k_version = myuname.release[0] - '0'; 
     48+ 
     49+       if (k_version < 2 || k_version > 9) 
     50+               return EINVAL; 
     51+ 
     52+       if (k_version == 2) { 
     53+               int k_patchlevel = myuname.release[2] - '0'; 
     54+               if (k_patchlevel <= 4) 
    4855+#if ENABLE_FEATURE_2_4_MODULES 
    49 +       if (k_version <= 4) 
    50 +               suffix = ".o"; 
    51 +       else 
     56+                       suffix = ".o"; 
     57+#else 
     58+                       return EINVAL; 
    5259+#endif 
    53 +               suffix = ".ko"; 
     60+       } 
    5461+ 
    5562+       len = strlen(filename); 
     
    101108 /* 2.6 style insmod has no options and required filename 
    102109  * (not module name - .ko can't be omitted) */ 
    103 @@ -59,9 +152,15 @@ int insmod_main(int argc UNUSED_PARAM, c 
     110@@ -59,9 +159,15 @@ int insmod_main(int argc UNUSED_PARAM, c 
    104111        if (!filename) 
    105112                bb_show_usage(); 
Note: See TracChangeset for help on using the changeset viewer.