diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 13cabfbe49..107230a214 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -113,6 +113,16 @@ #define NUM_TX_QUEUES 4 #endif +/* + * API in_compat_syscall() is introduced in 4.6 kernel to check whether we're + * in a compat syscall or not. It is a new way to query the syscall type, which + * works properly on all architectures. + * + */ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)) +static inline bool in_compat_syscall(void) { return is_compat_task(); } +#endif + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) || \ defined(CFG80211_REMOVE_IEEE80211_BACKPORT) #define HDD_NL80211_BAND_2GHZ NL80211_BAND_2GHZ diff --git a/core/hdd/src/wlan_hdd_ftm.c b/core/hdd/src/wlan_hdd_ftm.c index b806ba18a7..e702f967e6 100644 --- a/core/hdd/src/wlan_hdd_ftm.c +++ b/core/hdd/src/wlan_hdd_ftm.c @@ -205,7 +205,7 @@ int wlan_hdd_qcmbr_unified_ioctl(struct hdd_adapter *adapter, { int ret = 0; - if (is_compat_task()) + if (in_compat_syscall()) ret = wlan_hdd_qcmbr_compat_ioctl(adapter, ifr); else ret = wlan_hdd_qcmbr_ioctl(adapter, ifr); diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 32908cde3c..a16af0f544 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -7081,7 +7081,7 @@ static int __hdd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) switch (cmd) { case (SIOCDEVPRIVATE + 1): - if (is_compat_task()) + if (in_compat_syscall()) ret = hdd_driver_compat_ioctl(adapter, ifr); else ret = hdd_driver_ioctl(adapter, ifr); diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 3e01ba89f0..7aba5653ad 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -2952,7 +2952,7 @@ int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu) return -EINVAL; #ifdef CONFIG_COMPAT - if (is_compat_task()) { + if (in_compat_syscall()) { struct compat_iw_point *p_compat_priv_data; /* Compat task: @@ -6979,7 +6979,7 @@ static int __iw_setnone_getnone(struct net_device *dev, * compat support in the kernel does not handle this case. so we * need to explicitly handle it here. */ - if (is_compat_task()) { + if (in_compat_syscall()) { struct compat_iw_point *compat_iw_point = (struct compat_iw_point *)&wrqu->data; sub_cmd = compat_iw_point->flags;