Commit bef9bacc authored by Mariusz Kozlowski's avatar Mariusz Kozlowski Committed by John W. Linville

cfg80211:: fix possible NULL pointer dereference

In cfg80211_inform_bss_frame() wiphy is first dereferenced on privsz
initialisation and then it is checked for NULL. This patch fixes that.
Signed-off-by: default avatarMariusz Kozlowski <mk@lab.zgora.pl>
Acked-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 67aa030c
...@@ -585,16 +585,23 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, ...@@ -585,16 +585,23 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
struct cfg80211_internal_bss *res; struct cfg80211_internal_bss *res;
size_t ielen = len - offsetof(struct ieee80211_mgmt, size_t ielen = len - offsetof(struct ieee80211_mgmt,
u.probe_resp.variable); u.probe_resp.variable);
size_t privsz = wiphy->bss_priv_size; size_t privsz;
if (WARN_ON(!mgmt))
return NULL;
if (WARN_ON(!wiphy))
return NULL;
if (WARN_ON(wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC && if (WARN_ON(wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC &&
(signal < 0 || signal > 100))) (signal < 0 || signal > 100)))
return NULL; return NULL;
if (WARN_ON(!mgmt || !wiphy || if (WARN_ON(len < offsetof(struct ieee80211_mgmt, u.probe_resp.variable)))
len < offsetof(struct ieee80211_mgmt, u.probe_resp.variable)))
return NULL; return NULL;
privsz = wiphy->bss_priv_size;
res = kzalloc(sizeof(*res) + privsz + ielen, gfp); res = kzalloc(sizeof(*res) + privsz + ielen, gfp);
if (!res) if (!res)
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment