From e474427496ccb784878e10978f25b6e85de68850 Mon Sep 17 00:00:00 2001 From: Amarnath Hullur Subramanyam Date: Wed, 28 Oct 2015 21:10:14 -0700 Subject: wlan:Check priviledge permission for SET_POWER_PARAMS IOCTL 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_POWER_PARAMS IOCTL, making sure user task has right permission to process the command. CRs-Fixed: 930953 Git-commit: 6665a9697b404acf4d2e7d52d9c2b19512c9b239 Bug: 25344453 Signed-off-by: Amarnath Hullur Subramanyam --- drivers/staging/qcacld-2.0/CORE/HDD/src/wlan_hdd_wext.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/qcacld-2.0/CORE/HDD/src/wlan_hdd_wext.c b/drivers/staging/qcacld-2.0/CORE/HDD/src/wlan_hdd_wext.c index 1cbdf32..841ed4c 100644 --- a/drivers/staging/qcacld-2.0/CORE/HDD/src/wlan_hdd_wext.c +++ b/drivers/staging/qcacld-2.0/CORE/HDD/src/wlan_hdd_wext.c @@ -9434,6 +9434,12 @@ static int iw_set_power_params_priv(struct net_device *dev, char *ptr; VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Set power params Private"); + + if (!capable(CAP_NET_ADMIN)) { + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + FL("permission check failed")); + return -EPERM; + } /* ODD number is used for set, copy data using copy_from_user */ ptr = mem_alloc_copy_from_user_helper(wrqu->data.pointer, wrqu->data.length); -- cgit v1.1