浏览代码

qcacld-3.0: Check privilege permission for SET_VAR_INTS_GETNONE

qcacld-2.0 to qcacld-3.0 propagation

Kernel assumes all SET IOCTL commands are assigned with even
numbers. But in our WLAN driver, some SET IOCTLS are assigned with
odd numbers. This leads kernel fail to check, for some SET IOCTLs,
whether user has the right permission to do SET operation.
Hence, in driver, before processing SET_VAR_INTS_GETNONE, making
sure user task has right permission to process the command.

Change-Id: Icbdfe69c18c1ab3b75d63e046d5251307a794817
CRs-Fixed: 930942
Mukul Sharma 9 年之前
父节点
当前提交
910bb98ca8
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      core/hdd/src/wlan_hdd_wext.c

+ 6 - 0
core/hdd/src/wlan_hdd_wext.c

@@ -7883,6 +7883,12 @@ static int iw_hdd_set_var_ints_getnone(struct net_device *dev,
 	int apps_args[MAX_VAR_ARGS] = {0};
 	int ret, num_args;
 
+	if (!capable(CAP_NET_ADMIN)) {
+		CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
+			FL("permission check failed"));
+		return -EPERM;
+	}
+
 	/* Helper function to get iwreq_data with compat handling. */
 	if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu))
 		return -EINVAL;