mac80211: validate SIOCSIWPOWER arguments better
Johannes Berg
maintainerPATCH 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.
Signed-off-by Johannes Berg <[email protected]>
--- 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 ;
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
Signed-off-by Johannes Berg <[email protected]>
Reviewed-by Kalle Valo <[email protected]>
Signature · 1 line
Kalle Valo