public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtl8723bs/ioctl_linux: Add a security check to copy_from_user()
@ 2018-12-24  0:13 Aditya Pakki
  2019-01-02  9:10 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2018-12-24  0:13 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, Greg Kroah-Hartman, Quytelda Kahja, Michael Straube,
	Mamta Shukla, Nathan Chancellor, Arushi Singhal, Jia-Ju Bai,
	devel, linux-kernel

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-02  9:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-24  0:13 [PATCH] rtl8723bs/ioctl_linux: Add a security check to copy_from_user() Aditya Pakki
2019-01-02  9:10 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox