Skip to contentSkip to conversation

staging: vt6656: fix potential leak in vt6656_hostap_ioctl()

PATCH Superseded Christian Engelmayer 1 participant 1 message May 2, 2014 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: vt6656: fix potential leak in vt6656_hostap_ioctl()

Commit fb841d67 (staging: vt6656: don't leak 'param' in vt6656_hostap_ioctl() when returning -EOPNOTSUPP) cleaned up direct returns in the ioctl switch statement that leaked already allocated memory. Fix the same issue for VIAWGET_HOSTAPD_SCAN_REQ and VIAWGET_HOSTAPD_MLME that are also not supported by this driver. Detected by Coverity - CID 144381.

---
Compile tested and applies against branch staging-next of tree git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git

---
 drivers/staging/vt6656/hostap.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/vt6656/hostap.c +4 -2
index 67ba48b..a0d9fff 100644
@@ -742,7 +742,8 @@ int vt6656_hostap_ioctl(struct vnt_private *pDevice, struct iw_point *p)
 
 	case VIAWGET_HOSTAPD_MLME:
 	    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_MLME \n");
-	    return -EOPNOTSUPP;
+	    ret = -EOPNOTSUPP;
+	    goto out;
 
 	case VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT:
 	    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT \n");
@@ -751,7 +752,8 @@ int vt6656_hostap_ioctl(struct vnt_private *pDevice, struct iw_point *p)
 
 	case VIAWGET_HOSTAPD_SCAN_REQ:
 	    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SCAN_REQ \n");
-	    return -EOPNOTSUPP;
+	    ret = -EOPNOTSUPP;
+	    goto out;
 
 	case VIAWGET_HOSTAPD_STA_CLEAR_STATS:
 	    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_STA_CLEAR_STATS \n");
Signature · 1 line
1.9.1