Skip to content

Commit

Permalink
cfg80211: fix NULL pointer deference in reg_device_remove()
Browse files Browse the repository at this point in the history
We won't ever get here as regulatory_hint_core() can only fail
on -ENOMEM and in that case we don't initialize cfg80211 but this is
technically correct code.

This is actually good for stable, where we don't check for -ENOMEM
failure on __regulatory_hint()'s failure.

Cc: stable@kernel.org
Reported-by: Quentin Armitage <Quentin@armitage.org.uk>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Luis R. Rodriguez authored and John W. Linville committed Apr 16, 2009
1 parent 3664090 commit 0ad8aca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/wireless/reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2095,11 +2095,12 @@ int set_regdom(const struct ieee80211_regdomain *rd)
/* Caller must hold cfg80211_mutex */
void reg_device_remove(struct wiphy *wiphy)
{
struct wiphy *request_wiphy;
struct wiphy *request_wiphy = NULL;

assert_cfg80211_lock();

request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx);
if (last_request)
request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx);

kfree(wiphy->regd);
if (!last_request || !request_wiphy)
Expand Down

0 comments on commit 0ad8aca

Please sign in to comment.