cfg80211: fix channel check in cfg80211_can_use_iftype_chan
authorSimon Wunderlich <[email protected]>
Wed, 23 Jan 2013 14:15:57 +0000 (15:15 +0100)
committerJohannes Berg <[email protected]>
Thu, 24 Jan 2013 15:05:30 +0000 (16:05 +0100)
In commit "cfg80211: check radar interface combinations" a regression
was introduced which might lead to NULL dereference if the argument
chan = NULL, which might happen in IBSS/wext case (and probably
others).

Signed-off-by: Simon Wunderlich <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
net/wireless/util.c

index 1c2795d52db0a9d1a6cae01e836918e788be6314..d7873c7ae0ec7135c5b3882ccd9ea389cffcbeed 100644 (file)
@@ -1212,7 +1212,8 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
        case NL80211_IFTYPE_MESH_POINT:
        case NL80211_IFTYPE_P2P_GO:
        case NL80211_IFTYPE_WDS:
-               radar_required = !!(chan->flags & IEEE80211_CHAN_RADAR);
+               radar_required = !!(chan &&
+                                   (chan->flags & IEEE80211_CHAN_RADAR));
                break;
        case NL80211_IFTYPE_P2P_CLIENT:
        case NL80211_IFTYPE_STATION: