Skip to contentSkip to conversation

rtl8712: don't just return -EFAULT in

PATCH Ali Bahar 1 participant 1 message Aug 16, 2011 Kernel janitors

lore
Share & tools
lore

Ali Bahar

author
#0 lore raw
Quoted 11 lines · Dan Carpenter

There were some curly braces missing so the original code in wpa_supplicant_ioctl() pretty much always returned -EFAULT without doing anything.

drivers/staging/rtl8712/rtl871x_ioctl_linux.c +0 -0
index 40e6b5c..c380a30 100644

drivers/staging/rtl8712/rtl871x_ioctl_linux.c static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p) · line 2078

Quoted 8 lines
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +2 -1
@@ -2072,9 +2072,10 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)
 	param = (struct ieee_param *)_malloc(p->length);
 	if (param = NULL)
 		return -ENOMEM;
-	if (copy_from_user(param, p->pointer, p->length))
+	if (copy_from_user(param, p->pointer, p->length)) {
 		kfree((u8 *)param);
 		return -EFAULT;
+	}

Ouch! (Now emacs would've caught this! ;-))
My reading of the code suggests that (not surprisingly) this path does not get executed. The frequent case is to go thru wext-core's "standard" handler, instead of the above. If so, then that'd explain why I've not noticed this bug during testing.

Good catch.

thanks,
ali

Quoted 3 lines
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +0 -0
 	switch (param->cmd) {
 	case IEEE_CMD_SET_WPA_PARAM:
 		ret = wpa_set_param(dev, param->u.wpa_param.name,