Skip to content

Commit

Permalink
mac80211: validate SIOCSIWPOWER arguments better
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Berg authored and John W. Linville committed Jan 29, 2009
1 parent 4797938 commit e9aeaba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/mac80211/wext.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit e9aeaba

Please sign in to comment.