From aaf7476fa7fdc8d1865f20217c7c57ce561e03f7 Mon Sep 17 00:00:00 2001 From: Mukul Sharma Date: Thu, 17 Mar 2016 17:00:41 -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. Bug: 27104184 Change-Id: Iaab3d55c2acc75f65d6daf5998713cc9ff92a32c Signed-off-by: Yuan Lin --- drivers/staging/prima/CORE/HDD/src/wlan_hdd_wext.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wext.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wext.c index 7add243..85d881a 100644 --- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wext.c +++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wext.c @@ -6529,6 +6529,13 @@ static int iw_set_power_params_priv(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { + if (!capable(CAP_NET_ADMIN)) + { + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + FL("permission check failed")); + return -EPERM; + } + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Set power params Private"); return iw_set_power_params(dev,info,wrqu,extra,0); -- cgit v1.1