Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4cb3dc1 authored by taozhang's avatar taozhang Committed by Greg Kroah-Hartman
Browse files

wifi: mac80211: fix memory free error when registering wiphy fail



[ Upstream commit 50b2e8711462409cd368c41067405aa446dfa2af ]

ieee80211_register_hw free the allocated cipher suites when
registering wiphy fail, and ieee80211_free_hw will re-free it.

set wiphy_ciphers_allocated to false after freeing allocated
cipher suites.

Signed-off-by: default avatartaozhang <taozhang@bestechnic.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 4d2a309b
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1315,8 +1315,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
	ieee80211_led_exit(local);
	destroy_workqueue(local->workqueue);
 fail_workqueue:
	if (local->wiphy_ciphers_allocated)
	if (local->wiphy_ciphers_allocated) {
		kfree(local->hw.wiphy->cipher_suites);
		local->wiphy_ciphers_allocated = false;
	}
	kfree(local->int_scan_req);
	return result;
}
@@ -1386,8 +1388,10 @@ void ieee80211_free_hw(struct ieee80211_hw *hw)
	mutex_destroy(&local->iflist_mtx);
	mutex_destroy(&local->mtx);

	if (local->wiphy_ciphers_allocated)
	if (local->wiphy_ciphers_allocated) {
		kfree(local->hw.wiphy->cipher_suites);
		local->wiphy_ciphers_allocated = false;
	}

	idr_for_each(&local->ack_status_frames,
		     ieee80211_free_ack_frame, NULL);