Skip to contentSkip to conversation

mac80211: validate SIOCSIWPOWER arguments better

PATCH In review Johannes Berg 2 participants 2 messages Jan 6, 2009 – Jan 7, 2009 mac80211

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 mac80211: validate SIOCSIWPOWER arguments better

Don't accept any arguments we don't handle, and return error codes instead of using an uninitialised stack value.

---
 net/mac80211/wext.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/mac80211/wext.c +4 -1
@@ -852,9 +852,12 @@ static int ieee80211_ioctl_siwpower(stru
 		ps = true;
 		break;
 	default:                /* Otherwise we ignore */
-		break;
+		return -EINVAL;
 	}
 
+	if (wrq->flags & ~(IW_POWER_MODE | IW_POWER_TIMEOUT))
+		return -EINVAL;
+
 	if (wrq->flags & IW_POWER_TIMEOUT)
 		timeout = wrq->value / 1000;
 
Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Johannes Berg

Don't accept any arguments we don't handle,

Makes sense to me. wrq->disabled case is not checked because of the ugly goto, but at least for me that looks ok.

Quoted 2 lines

and return error codes instead of using an uninitialised stack value.

You refer to ps variable here, right? Yeah, I wrote that. Sorry.

Quoted 1 line
Signature · 1 line
Kalle Valo