lkml.org 
[lkml]   [2018]   [Dec]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] rtl8723bs/ioctl_linux: Add a security check to copy_from_user()
Date
Currently, the return value of copy_from_user is not checked.
extra is assigned to u32wps_start irrespective of these failures.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index b8631baf128d..9992caa8c839 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -2577,14 +2577,19 @@ static int rtw_wps_start(struct net_device *dev,
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct iw_point *pdata = &wrqu->data;
u32 u32wps_start = 0;
- unsigned int uintRet = 0;

if ((true == padapter->bDriverStopped) ||(true ==padapter->bSurpriseRemoved) || (NULL == pdata)) {
ret = -EINVAL;
goto exit;
}

- uintRet = copy_from_user((void*)&u32wps_start, pdata->pointer, 4);
+ ret = copy_from_user((void *)&u32wps_start, pdata->pointer, 4);
+
+ if (ret) {
+ ret = -EINVAL;
+ goto exit;
+ }
+
if (u32wps_start == 0)
u32wps_start = *extra;

--
2.17.1
\
 
 \ /
  Last update: 2018-12-24 01:25    [W:0.059 / U:34.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site