From e9aeabaeb9a0bece50100dc74bbd720a68cb8f5c Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 6 Jan 2009 18:12:35 +0100 Subject: 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 Reviewed-by: Kalle Valo Signed-off-by: John W. Linville --- net/mac80211/wext.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'net/mac80211/wext.c') diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index 5690c3d41e7d..3fc1b903bfbc 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c @@ -853,9 +853,12 @@ static int ieee80211_ioctl_siwpower(struct net_device *dev, 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; -- cgit v1.2.3