mac80211: validate SIOCSIWPOWER arguments better
authorJohannes Berg <johannes@sipsolutions.net>
Tue, 6 Jan 2009 17:12:35 +0000 (18:12 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 29 Jan 2009 20:59:55 +0000 (15:59 -0500)
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 <johannes@sipsolutions.net>
Reviewed-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/wext.c

index 5690c3d41e7d650f09d7c39753c7a08fade0430f..3fc1b903bfbc30f8023b1ed83855cb8a1abfdfed 100644 (file)
@@ -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;