brektrou / rtl8821CU

Realtek RTL8811CU/RTL8821CU USB Wi-Fi adapter driver for Linux
GNU General Public License v2.0
1.59k stars 461 forks source link

Driver doesn't build on kernel 5.10.0-0.rc3.68.fc34.x86_64 #100

Closed patbarron closed 3 years ago

patbarron commented 3 years ago

The rtl8821CU driver doesn't build on kernel version 5.10.0-0.rc3.68.fc34.x86_64 (Fedora Rawhide) because the get_fs() and set_fs() APIs have been removed from the kernel. These kernel APIs are called from several places in the driver.

core/rtw_btcoex.c core/rtw_wlan_util.c os_dep/linux/os_intfs.c os_dep/linux/osdep_service.c

The use of these APIs has been discouraged for some time, and they were finally removed in kernel 5.10-rc1.

See https://www.zdnet.com/article/linux-5-10-finally-ditches-decades-old-tool-that-caused-security-bugs for some additional details.

IlgazC commented 3 years ago

Same here on Manjaro kernel 5.10.rc4 . So, either these API calls get removed or we are stuck on a LTS kernel eh?

Sauerlandlinux commented 3 years ago

Maybe this patch will help:

https://www.krauttranslate.de/~sauerland/Patches/rtl8821cu-kernel510.patch

patbarron commented 3 years ago

It looks like this proposed patch just ifdef's out the calls to set_fs() and get_fs(), without replacing them with anything - does that actually work? If so, why bother using these APIs in the first place?

Sauerlandlinux commented 3 years ago

Change #ifdef set_fs to #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)

But the old patch has also worked.

The old one was ported from here: https://github.com/Mange/rtl8192eu-linux-driver/pull/201 https://github.com/Mange/rtl8192eu-linux-driver/pull/201/commits/8ba6813bfd8c0d3a796dc0a441458d017ec9df15

d00rsfan commented 3 years ago

5.10.1 is still error:

os_dep/osdep_service.c:2240:12: error: incompatible types when assigning to type ‘mm_segment_t’ from type ‘int’
 2240 |    oldfs = get_fs();
      |            ^~~~~~
Sauerlandlinux commented 3 years ago

Here it builds against kernel 5.10.1: https://build.opensuse.org/build/home:Sauerland/Kernel_HEAD/x86_64/rtl8821cu/_log https://build.opensuse.org/package/live_build_log/home:Sauerland/rtl8821cu/Kernel_stable/x86_64

So maybe a bug in your patch?

brektrou commented 3 years ago

Fixed