From 64a70e8c021a36e3aeacd8a0eee64b165c45a0b5 Mon Sep 17 00:00:00 2001 From: Mukul Sharma Date: Mon, 2 Nov 2015 20:05:09 +0530 Subject: [PATCH] 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 --- core/hdd/src/wlan_hdd_wext.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index d20cf03b7df5..4e1654d7037d 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/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;