2009-01-06 17:12:22

by Johannes Berg

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Johannes Berg <[email protected]>
---
net/mac80211/wext.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

--- wireless-testing.orig/net/mac80211/wext.c 2009-01-06 18:10:07.000000000 +0100
+++ wireless-testing/net/mac80211/wext.c 2009-01-06 18:10:23.000000000 +0100
@@ -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;





2009-01-07 14:51:47

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] mac80211: validate SIOCSIWPOWER arguments better

Johannes Berg <[email protected]> writes:

> 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.

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

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

> Signed-off-by: Johannes Berg <[email protected]>

Reviewed-by: Kalle Valo <[email protected]>

--
Kalle Valo