cfg80211: fix wext iw_freq parsing
commit0b258582fef3a9b15b2372d99164859361faa8db
authorJohannes Berg <johannes@sipsolutions.net>
Fri, 8 May 2009 07:42:33 +0000 (8 09:42 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 11 May 2009 19:23:54 +0000 (11 15:23 -0400)
tree4467eb0ffbb199f7fd3aeb1418dfc31e7b344c25
parentaa837e1d6bd1a71b3c30c7738b6c29d41512fe7d
cfg80211: fix wext iw_freq parsing

The function to parse a struct iw_freq has a stupid bug,
it returns NULL when the channel cannot be found at all,
but NULL is supposed to mean "auto". Fix this by checking
the return value of ieee80211_get_channel() and returning
ERR_PTR(-EINVAL) if it returned NULL (channel not found).

This fixes an issue where you could say (in IBSS mode)
iwconfig wlan0 channel 21
and it would use channel 1 instead because that's the
first available channel with IBSS allowed (which is what
the "auto" setting uses).

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/wireless/wext-compat.c