Explorar el Código

Fixes in 9fd63b7fe849f5fa8019c897d1642ce4f34bf3f7

get_fs and set_fs are deprecated in Linux kernel. That's why thread_info fixes needs to made in tree. But for this commit, I didn't recognize whole problem.
Suleyman Poyraz hace 5 años
padre
commit
c2424c442d
Se han modificado 4 ficheros con 44 adiciones y 1 borrados
  1. 6 1
      core/rtw_btcoex.c
  2. 5 0
      core/rtw_wlan_util.c
  3. 17 0
      os_dep/linux/os_intfs.c
  4. 16 0
      os_dep/osdep_service.c

+ 6 - 1
core/rtw_btcoex.c

@@ -1475,9 +1475,12 @@ u8 rtw_btcoex_sendmsgbysocket(_adapter *padapter, u8 *msg, u8 msg_size, bool for
 	udpmsg.msg_controllen = 0;
 	udpmsg.msg_flags	= MSG_DONTWAIT | MSG_NOSIGNAL;
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0))
 	oldfs = get_fs();
 	set_fs(KERNEL_DS);
+#else
+	oldfs = (current_thread_info()->addr_limit);
+	current_thread_info()->addr_limit = (MAKE_MM_SEG(-1UL));
 #endif
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))
@@ -1487,6 +1490,8 @@ u8 rtw_btcoex_sendmsgbysocket(_adapter *padapter, u8 *msg, u8 msg_size, bool for
 #endif
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
 	set_fs(oldfs);
+#else
+	current_thread_info()->addr_limit = (oldfs);
 #endif
 	if (error < 0) {
 		RTW_INFO("Error when sendimg msg, error:%d\n", error);

+ 5 - 0
core/rtw_wlan_util.c

@@ -4754,6 +4754,9 @@ int rtw_dev_nlo_info_set(struct pno_nlo_info *nlo_info, pno_ssid_t *ssid,
 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0))
 	fs = get_fs();
 	set_fs(KERNEL_DS);
+#else
+	fs = (current_thread_info()->addr_limit);
+	current_thread_info()->addr_limit = (MAKE_MM_SEG(-1UL));
 #endif
 
 	source = rtw_zmalloc(2048);
@@ -4766,6 +4769,8 @@ int rtw_dev_nlo_info_set(struct pno_nlo_info *nlo_info, pno_ssid_t *ssid,
 
 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0))
 	set_fs(fs);
+#else
+	current_thread_info()->addr_limit = (fs);
 #endif
 	filp_close(fp, NULL);
 

+ 17 - 0
os_dep/linux/os_intfs.c

@@ -4011,6 +4011,9 @@ static int route_dump(u32 *gw_addr , int *gw_index)
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
 	oldfs = get_fs();
 	set_fs(KERNEL_DS);
+#else
+	oldfs = (current_thread_info()->addr_limit);
+	current_thread_info()->addr_limit = ((mm_segment_t) { (-1UL) });
 #endif
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))
 	err = sock_sendmsg(sock, &msg);
@@ -4019,6 +4022,8 @@ static int route_dump(u32 *gw_addr , int *gw_index)
 #endif
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
 	set_fs(oldfs);
+#else
+	current_thread_info()->addr_limit = (oldfs);
 #endif
 
 	if (err < 0)
@@ -4047,6 +4052,9 @@ restart:
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
 		oldfs = get_fs();
 		set_fs(KERNEL_DS);
+#else
+	oldfs = (current_thread_info()->addr_limit);
+	current_thread_info()->addr_limit = ((mm_segment_t) { (-1UL) });
 #endif
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))
 		err = sock_recvmsg(sock, &msg, MSG_DONTWAIT);
@@ -4055,6 +4063,9 @@ restart:
 #endif
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
 		set_fs(oldfs);
+#else
+		current_thread_info()->addr_limit = (oldfs);
+
 #endif
 
 		if (err < 0)
@@ -4129,6 +4140,9 @@ done:
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
 		oldfs = get_fs();
 		set_fs(KERNEL_DS);
+#else
+		oldfs = (current_thread_info()->addr_limit);
+		current_thread_info()->addr_limit = ((mm_segment_t) { (-1UL) });
 #endif
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))
 		err = sock_sendmsg(sock, &msg);
@@ -4137,6 +4151,9 @@ done:
 #endif
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
 		set_fs(oldfs);
+#else
+		current_thread_info()->addr_limit = (oldfs);
+
 #endif
 
 		if (err > 0)

+ 16 - 0
os_dep/osdep_service.c

@@ -2203,6 +2203,9 @@ static int isFileReadable(const char *path, u32 *sz)
 	#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
 		oldfs = get_fs();
 		set_fs(KERNEL_DS);
+	#else
+		oldfs = (current_thread_info()->addr_limit);
+		current_thread_info()->addr_limit = ((mm_segment_t) { (-1UL) });
 	#endif
 
 		if (1 != readFile(fp, &buf, 1))
@@ -2218,6 +2221,9 @@ static int isFileReadable(const char *path, u32 *sz)
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
 		set_fs(oldfs);
+#else
+		current_thread_info()->addr_limit = (oldfs);
+
 #endif
 		filp_close(fp, NULL);
 	}
@@ -2245,10 +2251,15 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
 		#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
 			oldfs = get_fs();
 			set_fs(KERNEL_DS);
+		#else
+			oldfs = (current_thread_info()->addr_limit);
+				current_thread_info()->addr_limit = ((mm_segment_t) { (-1UL) });
 		#endif
 			ret = readFile(fp, buf, sz);
 		#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
 			set_fs(oldfs);
+		#else
+			current_thread_info()->addr_limit = (oldfs);
 		#endif
 			closeFile(fp);
 
@@ -2284,10 +2295,15 @@ static int storeToFile(const char *path, u8 *buf, u32 sz)
 		#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
 			oldfs = get_fs();
 			set_fs(KERNEL_DS);
+		#else
+			oldfs = (current_thread_info()->addr_limit);
+			current_thread_info()->addr_limit = ((mm_segment_t) { (-1UL) });
 		#endif
 			ret = writeFile(fp, buf, sz);
 		#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
 			set_fs(oldfs);
+		#else
+			current_thread_info()->addr_limit = (oldfs);
 		#endif
 			closeFile(fp);