mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2024-11-15 01:19:36 +00:00
rtl8188eu: Add checks for p->length and remove some goto statements
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
b572d3030a
commit
f86165a975
1 changed files with 12 additions and 37 deletions
|
@ -6720,21 +6720,16 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)
|
|||
|
||||
/* down(&ieee->wx_sem); */
|
||||
|
||||
if (p->length < sizeof(struct ieee_param) || !p->pointer) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (!p->pointer || p->length != sizeof(struct ieee_param))
|
||||
return -EINVAL;
|
||||
|
||||
param = (struct ieee_param *)rtw_malloc(p->length);
|
||||
if (param == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
if (param == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
if (copy_from_user(param, p->pointer, p->length)) {
|
||||
rtw_mfree((u8 *)param, p->length);
|
||||
ret = -EFAULT;
|
||||
goto out;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
switch (param->cmd) {
|
||||
|
@ -6767,13 +6762,7 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)
|
|||
ret = -EFAULT;
|
||||
|
||||
rtw_mfree((u8 *)param, p->length);
|
||||
|
||||
out:
|
||||
|
||||
/* up(&ieee->wx_sem); */
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
#ifdef CONFIG_AP_MODE
|
||||
|
@ -7574,32 +7563,21 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p)
|
|||
* so, we just check hw_init_completed
|
||||
*/
|
||||
|
||||
if (!rtw_is_hw_init_completed(padapter)) {
|
||||
ret = -EPERM;
|
||||
goto out;
|
||||
}
|
||||
if (!rtw_is_hw_init_completed(padapter))
|
||||
return -EPERM;
|
||||
|
||||
|
||||
/* if (p->length < sizeof(struct ieee_param) || !p->pointer){ */
|
||||
if (!p->pointer) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (!p->pointer || p->length != sizeof(struct ieee_param))
|
||||
return -EINVAL;
|
||||
|
||||
param = (struct ieee_param *)rtw_malloc(p->length);
|
||||
if (param == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
if (param == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
if (copy_from_user(param, p->pointer, p->length)) {
|
||||
rtw_mfree((u8 *)param, p->length);
|
||||
ret = -EFAULT;
|
||||
goto out;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
/* RTW_INFO("%s, cmd=%d\n", __func__, param->cmd); */
|
||||
|
||||
switch (param->cmd) {
|
||||
case RTL871X_HOSTAPD_FLUSH:
|
||||
|
||||
|
@ -7692,10 +7670,7 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p)
|
|||
|
||||
rtw_mfree((u8 *)param, p->length);
|
||||
|
||||
out:
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue