Commit 5549b088 authored by Johannes Berg's avatar Johannes Berg

wifi: mac80211: add more ops assertions

Add more might_sleep() checks and check sdata-in-driver
for one additional place.

type=feature
ticket=jira:WIFI-314309
Reviewed-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 1b672118
...@@ -285,6 +285,8 @@ int drv_assign_vif_chanctx(struct ieee80211_local *local, ...@@ -285,6 +285,8 @@ int drv_assign_vif_chanctx(struct ieee80211_local *local,
{ {
int ret = 0; int ret = 0;
might_sleep();
drv_verify_link_exists(sdata, link_conf); drv_verify_link_exists(sdata, link_conf);
if (!check_sdata_in_driver(sdata)) if (!check_sdata_in_driver(sdata))
return -EIO; return -EIO;
......
...@@ -40,6 +40,8 @@ static inline void drv_tx(struct ieee80211_local *local, ...@@ -40,6 +40,8 @@ static inline void drv_tx(struct ieee80211_local *local,
static inline void drv_sync_rx_queues(struct ieee80211_local *local, static inline void drv_sync_rx_queues(struct ieee80211_local *local,
struct sta_info *sta) struct sta_info *sta)
{ {
might_sleep();
if (local->ops->sync_rx_queues) { if (local->ops->sync_rx_queues) {
trace_drv_sync_rx_queues(local, sta->sdata, &sta->sta); trace_drv_sync_rx_queues(local, sta->sdata, &sta->sta);
local->ops->sync_rx_queues(&local->hw); local->ops->sync_rx_queues(&local->hw);
...@@ -569,6 +571,8 @@ static inline void drv_sta_statistics(struct ieee80211_local *local, ...@@ -569,6 +571,8 @@ static inline void drv_sta_statistics(struct ieee80211_local *local,
struct ieee80211_sta *sta, struct ieee80211_sta *sta,
struct station_info *sinfo) struct station_info *sinfo)
{ {
might_sleep();
sdata = get_bss_sdata(sdata); sdata = get_bss_sdata(sdata);
if (!check_sdata_in_driver(sdata)) if (!check_sdata_in_driver(sdata))
return; return;
...@@ -616,6 +620,8 @@ static inline int drv_get_survey(struct ieee80211_local *local, int idx, ...@@ -616,6 +620,8 @@ static inline int drv_get_survey(struct ieee80211_local *local, int idx,
{ {
int ret = -EOPNOTSUPP; int ret = -EOPNOTSUPP;
might_sleep();
trace_drv_get_survey(local, idx, survey); trace_drv_get_survey(local, idx, survey);
if (local->ops->get_survey) if (local->ops->get_survey)
...@@ -797,6 +803,8 @@ static inline void drv_set_rekey_data(struct ieee80211_local *local, ...@@ -797,6 +803,8 @@ static inline void drv_set_rekey_data(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata, struct ieee80211_sub_if_data *sdata,
struct cfg80211_gtk_rekey_data *data) struct cfg80211_gtk_rekey_data *data)
{ {
might_sleep();
if (!check_sdata_in_driver(sdata)) if (!check_sdata_in_driver(sdata))
return; return;
...@@ -987,6 +995,8 @@ static inline void drv_stop_ap(struct ieee80211_local *local, ...@@ -987,6 +995,8 @@ static inline void drv_stop_ap(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata, struct ieee80211_sub_if_data *sdata,
struct ieee80211_bss_conf *link_conf) struct ieee80211_bss_conf *link_conf)
{ {
might_sleep();
/* make sure link_conf is protected */ /* make sure link_conf is protected */
drv_verify_link_exists(sdata, link_conf); drv_verify_link_exists(sdata, link_conf);
...@@ -1016,6 +1026,8 @@ drv_set_default_unicast_key(struct ieee80211_local *local, ...@@ -1016,6 +1026,8 @@ drv_set_default_unicast_key(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata, struct ieee80211_sub_if_data *sdata,
int key_idx) int key_idx)
{ {
might_sleep();
if (!check_sdata_in_driver(sdata)) if (!check_sdata_in_driver(sdata))
return; return;
...@@ -1046,6 +1058,8 @@ drv_channel_switch_beacon(struct ieee80211_sub_if_data *sdata, ...@@ -1046,6 +1058,8 @@ drv_channel_switch_beacon(struct ieee80211_sub_if_data *sdata,
{ {
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
might_sleep();
if (local->ops->channel_switch_beacon) { if (local->ops->channel_switch_beacon) {
trace_drv_channel_switch_beacon(local, sdata, chandef); trace_drv_channel_switch_beacon(local, sdata, chandef);
local->ops->channel_switch_beacon(&local->hw, &sdata->vif, local->ops->channel_switch_beacon(&local->hw, &sdata->vif,
...@@ -1060,6 +1074,8 @@ drv_pre_channel_switch(struct ieee80211_sub_if_data *sdata, ...@@ -1060,6 +1074,8 @@ drv_pre_channel_switch(struct ieee80211_sub_if_data *sdata,
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
int ret = 0; int ret = 0;
might_sleep();
if (!check_sdata_in_driver(sdata)) if (!check_sdata_in_driver(sdata))
return -EIO; return -EIO;
...@@ -1077,6 +1093,8 @@ drv_post_channel_switch(struct ieee80211_sub_if_data *sdata) ...@@ -1077,6 +1093,8 @@ drv_post_channel_switch(struct ieee80211_sub_if_data *sdata)
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
int ret = 0; int ret = 0;
might_sleep();
if (!check_sdata_in_driver(sdata)) if (!check_sdata_in_driver(sdata))
return -EIO; return -EIO;
...@@ -1092,6 +1110,8 @@ drv_abort_channel_switch(struct ieee80211_sub_if_data *sdata) ...@@ -1092,6 +1110,8 @@ drv_abort_channel_switch(struct ieee80211_sub_if_data *sdata)
{ {
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
might_sleep();
if (!check_sdata_in_driver(sdata)) if (!check_sdata_in_driver(sdata))
return; return;
...@@ -1107,6 +1127,8 @@ drv_channel_switch_rx_beacon(struct ieee80211_sub_if_data *sdata, ...@@ -1107,6 +1127,8 @@ drv_channel_switch_rx_beacon(struct ieee80211_sub_if_data *sdata,
{ {
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
might_sleep();
if (!check_sdata_in_driver(sdata)) if (!check_sdata_in_driver(sdata))
return; return;
...@@ -1163,6 +1185,8 @@ static inline int drv_get_txpower(struct ieee80211_local *local, ...@@ -1163,6 +1185,8 @@ static inline int drv_get_txpower(struct ieee80211_local *local,
{ {
int ret; int ret;
might_sleep();
if (!local->ops->get_txpower) if (!local->ops->get_txpower)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -1267,6 +1291,10 @@ drv_get_ftm_responder_stats(struct ieee80211_local *local, ...@@ -1267,6 +1291,10 @@ drv_get_ftm_responder_stats(struct ieee80211_local *local,
{ {
u32 ret = -EOPNOTSUPP; u32 ret = -EOPNOTSUPP;
might_sleep();
if (!check_sdata_in_driver(sdata))
return -EIO;
if (local->ops->get_ftm_responder_stats) if (local->ops->get_ftm_responder_stats)
ret = local->ops->get_ftm_responder_stats(&local->hw, ret = local->ops->get_ftm_responder_stats(&local->hw,
&sdata->vif, &sdata->vif,
...@@ -1436,6 +1464,8 @@ static inline void drv_sta_set_4addr(struct ieee80211_local *local, ...@@ -1436,6 +1464,8 @@ static inline void drv_sta_set_4addr(struct ieee80211_local *local,
struct ieee80211_sta *sta, bool enabled) struct ieee80211_sta *sta, bool enabled)
{ {
sdata = get_bss_sdata(sdata); sdata = get_bss_sdata(sdata);
might_sleep();
if (!check_sdata_in_driver(sdata)) if (!check_sdata_in_driver(sdata))
return; return;
...@@ -1451,6 +1481,8 @@ static inline void drv_sta_set_decap_offload(struct ieee80211_local *local, ...@@ -1451,6 +1481,8 @@ static inline void drv_sta_set_decap_offload(struct ieee80211_local *local,
bool enabled) bool enabled)
{ {
sdata = get_bss_sdata(sdata); sdata = get_bss_sdata(sdata);
might_sleep();
if (!check_sdata_in_driver(sdata)) if (!check_sdata_in_driver(sdata))
return; return;
...@@ -1526,6 +1558,8 @@ static inline int drv_net_setup_tc(struct ieee80211_local *local, ...@@ -1526,6 +1558,8 @@ static inline int drv_net_setup_tc(struct ieee80211_local *local,
{ {
int ret = -EOPNOTSUPP; int ret = -EOPNOTSUPP;
might_sleep();
sdata = get_bss_sdata(sdata); sdata = get_bss_sdata(sdata);
trace_drv_net_setup_tc(local, sdata, type); trace_drv_net_setup_tc(local, sdata, type);
if (local->ops->net_setup_tc) if (local->ops->net_setup_tc)
......
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