Commit e72f8762 authored by Jesper Juhl's avatar Jesper Juhl Committed by Greg Kroah-Hartman

staging: vt6655: don't leak when returning -EOPNOTSUPP in vt6655_hostap_ioctl

Make sure we always free(param); and remove a redundant "goto out;"
just before we'll hit the label anyway.
Signed-off-by: default avatarJesper Juhl <jj@chaosbits.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6b8c2819
...@@ -720,7 +720,6 @@ static int hostap_get_encryption(PSDevice pDevice, ...@@ -720,7 +720,6 @@ static int hostap_get_encryption(PSDevice pDevice,
* Return Value: * Return Value:
* *
*/ */
int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p) int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p)
{ {
struct viawget_hostapd_param *param; struct viawget_hostapd_param *param;
...@@ -755,8 +754,8 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p) ...@@ -755,8 +754,8 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p)
break; break;
case VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR: case VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR \n");
return -EOPNOTSUPP; ret = -EOPNOTSUPP;
break; goto out;
case VIAWGET_HOSTAPD_FLUSH: case VIAWGET_HOSTAPD_FLUSH:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_FLUSH \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_FLUSH \n");
spin_lock_irq(&pDevice->lock); spin_lock_irq(&pDevice->lock);
...@@ -790,40 +789,36 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p) ...@@ -790,40 +789,36 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_FLAGS_STA \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_FLAGS_STA \n");
ret = hostap_set_flags_sta(pDevice, param); ret = hostap_set_flags_sta(pDevice, param);
break; break;
case VIAWGET_HOSTAPD_MLME: case VIAWGET_HOSTAPD_MLME:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_MLME \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_MLME \n");
return -EOPNOTSUPP; ret = -EOPNOTSUPP;
goto out;
case VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT: case VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT \n");
ret = hostap_set_generic_element(pDevice, param); ret = hostap_set_generic_element(pDevice, param);
break; break;
case VIAWGET_HOSTAPD_SCAN_REQ: case VIAWGET_HOSTAPD_SCAN_REQ:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SCAN_REQ \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SCAN_REQ \n");
return -EOPNOTSUPP; ret = -EOPNOTSUPP;
goto out;
case VIAWGET_HOSTAPD_STA_CLEAR_STATS: case VIAWGET_HOSTAPD_STA_CLEAR_STATS:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_STA_CLEAR_STATS \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_STA_CLEAR_STATS \n");
return -EOPNOTSUPP; ret = -EOPNOTSUPP;
goto out;
default: default:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vt6655_hostap_ioctl: unknown cmd=%d\n", DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vt6655_hostap_ioctl: unknown cmd=%d\n",
(int)param->cmd); (int)param->cmd);
return -EOPNOTSUPP; ret = -EOPNOTSUPP;
break; goto out;
} }
if ((ret == 0) && ap_ioctl) { if ((ret == 0) && ap_ioctl) {
if (copy_to_user(p->pointer, param, p->length)) { if (copy_to_user(p->pointer, param, p->length)) {
ret = -EFAULT; ret = -EFAULT;
goto out;
} }
} }
out: out:
kfree(param); kfree(param);
return ret; return ret;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment