qcacld-3.0: Use in_compat_syscall() to check compatness

Use in_compat_syscall() to query the syscall type, so it works properly
on all architectures. Also maintain backward compatibility with older
kernel.

Change-Id: Ife19c9874dcacc18c5d19c1175988bee66ea1cdd
CRs-Fixed: 2215566
This commit is contained in:
Mahesh Kumar Kalikot Veetil
2018-03-26 14:46:59 -07:00
committed by nshrivas
parent d2f92c4f93
commit 885a77b67c
4 changed files with 14 additions and 4 deletions

View File

@@ -113,6 +113,16 @@
#define NUM_TX_QUEUES 4 #define NUM_TX_QUEUES 4
#endif #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)) || \ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) || \
defined(CFG80211_REMOVE_IEEE80211_BACKPORT) defined(CFG80211_REMOVE_IEEE80211_BACKPORT)
#define HDD_NL80211_BAND_2GHZ NL80211_BAND_2GHZ #define HDD_NL80211_BAND_2GHZ NL80211_BAND_2GHZ

View File

@@ -205,7 +205,7 @@ int wlan_hdd_qcmbr_unified_ioctl(struct hdd_adapter *adapter,
{ {
int ret = 0; int ret = 0;
if (is_compat_task()) if (in_compat_syscall())
ret = wlan_hdd_qcmbr_compat_ioctl(adapter, ifr); ret = wlan_hdd_qcmbr_compat_ioctl(adapter, ifr);
else else
ret = wlan_hdd_qcmbr_ioctl(adapter, ifr); ret = wlan_hdd_qcmbr_ioctl(adapter, ifr);

View File

@@ -7081,7 +7081,7 @@ static int __hdd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
switch (cmd) { switch (cmd) {
case (SIOCDEVPRIVATE + 1): case (SIOCDEVPRIVATE + 1):
if (is_compat_task()) if (in_compat_syscall())
ret = hdd_driver_compat_ioctl(adapter, ifr); ret = hdd_driver_compat_ioctl(adapter, ifr);
else else
ret = hdd_driver_ioctl(adapter, ifr); ret = hdd_driver_ioctl(adapter, ifr);

View File

@@ -2952,7 +2952,7 @@ int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu)
return -EINVAL; return -EINVAL;
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
if (is_compat_task()) { if (in_compat_syscall()) {
struct compat_iw_point *p_compat_priv_data; struct compat_iw_point *p_compat_priv_data;
/* Compat task: /* 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 * compat support in the kernel does not handle this case. so we
* need to explicitly handle it here. * 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 *compat_iw_point =
(struct compat_iw_point *)&wrqu->data; (struct compat_iw_point *)&wrqu->data;
sub_cmd = compat_iw_point->flags; sub_cmd = compat_iw_point->flags;