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); */
|
/* down(&ieee->wx_sem); */
|
||||||
|
|
||||||
if (p->length < sizeof(struct ieee_param) || !p->pointer) {
|
if (!p->pointer || p->length != sizeof(struct ieee_param))
|
||||||
ret = -EINVAL;
|
return -EINVAL;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
param = (struct ieee_param *)rtw_malloc(p->length);
|
param = (struct ieee_param *)rtw_malloc(p->length);
|
||||||
if (param == NULL) {
|
if (param == NULL)
|
||||||
ret = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (copy_from_user(param, p->pointer, p->length)) {
|
if (copy_from_user(param, p->pointer, p->length)) {
|
||||||
rtw_mfree((u8 *)param, p->length);
|
rtw_mfree((u8 *)param, p->length);
|
||||||
ret = -EFAULT;
|
return -EFAULT;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (param->cmd) {
|
switch (param->cmd) {
|
||||||
|
@ -6767,13 +6762,7 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
|
|
||||||
rtw_mfree((u8 *)param, p->length);
|
rtw_mfree((u8 *)param, p->length);
|
||||||
|
|
||||||
out:
|
|
||||||
|
|
||||||
/* up(&ieee->wx_sem); */
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_AP_MODE
|
#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
|
* so, we just check hw_init_completed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!rtw_is_hw_init_completed(padapter)) {
|
if (!rtw_is_hw_init_completed(padapter))
|
||||||
ret = -EPERM;
|
return -EPERM;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!p->pointer || p->length != sizeof(struct ieee_param))
|
||||||
/* if (p->length < sizeof(struct ieee_param) || !p->pointer){ */
|
return -EINVAL;
|
||||||
if (!p->pointer) {
|
|
||||||
ret = -EINVAL;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
param = (struct ieee_param *)rtw_malloc(p->length);
|
param = (struct ieee_param *)rtw_malloc(p->length);
|
||||||
if (param == NULL) {
|
if (param == NULL)
|
||||||
ret = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (copy_from_user(param, p->pointer, p->length)) {
|
if (copy_from_user(param, p->pointer, p->length)) {
|
||||||
rtw_mfree((u8 *)param, p->length);
|
rtw_mfree((u8 *)param, p->length);
|
||||||
ret = -EFAULT;
|
return -EFAULT;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* RTW_INFO("%s, cmd=%d\n", __func__, param->cmd); */
|
|
||||||
|
|
||||||
switch (param->cmd) {
|
switch (param->cmd) {
|
||||||
case RTL871X_HOSTAPD_FLUSH:
|
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);
|
rtw_mfree((u8 *)param, p->length);
|
||||||
|
|
||||||
out:
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue