* [PATCH 2/5] nl80211: always check nla_put* return values
2016-09-14 8:11 [PATCH 1/5] nl80211: always check nla_nest_start() return value Johannes Berg
@ 2016-09-14 8:11 ` Johannes Berg
2016-09-14 8:11 ` [PATCH 3/5] mac80211: remove unused assignment Johannes Berg
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2016-09-14 8:11 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
A few instances were found where we didn't check them, add the
missing checks even though they'll probably never trigger as
the message should be large enough here.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/wireless/nl80211.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 4c8cc743ae7d..ec024cb90faa 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -9444,8 +9444,10 @@ static int nl80211_send_wowlan_nd(struct sk_buff *msg,
if (!freqs)
return -ENOBUFS;
- for (i = 0; i < req->n_channels; i++)
- nla_put_u32(msg, i, req->channels[i]->center_freq);
+ for (i = 0; i < req->n_channels; i++) {
+ if (nla_put_u32(msg, i, req->channels[i]->center_freq))
+ return -ENOBUFS;
+ }
nla_nest_end(msg, freqs);
@@ -9459,9 +9461,10 @@ static int nl80211_send_wowlan_nd(struct sk_buff *msg,
if (!match)
return -ENOBUFS;
- nla_put(msg, NL80211_SCHED_SCAN_MATCH_ATTR_SSID,
- req->match_sets[i].ssid.ssid_len,
- req->match_sets[i].ssid.ssid);
+ if (nla_put(msg, NL80211_SCHED_SCAN_MATCH_ATTR_SSID,
+ req->match_sets[i].ssid.ssid_len,
+ req->match_sets[i].ssid.ssid))
+ return -ENOBUFS;
nla_nest_end(msg, match);
}
nla_nest_end(msg, matches);
--
2.8.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/5] mac80211: remove unused assignment
2016-09-14 8:11 [PATCH 1/5] nl80211: always check nla_nest_start() return value Johannes Berg
2016-09-14 8:11 ` [PATCH 2/5] nl80211: always check nla_put* return values Johannes Berg
@ 2016-09-14 8:11 ` Johannes Berg
2016-09-14 8:11 ` [PATCH 4/5] mac80211: remove pointless chanctx NULL check Johannes Berg
2016-09-14 8:11 ` [PATCH 5/5] mac80211: remove sta_remove_debugfs driver callback Johannes Berg
3 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2016-09-14 8:11 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
The next line overwrites this assignment, so remove it; there's
no real value in using it for the next assignment either.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/util.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index e777c2a6568f..b6865d884487 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2555,7 +2555,6 @@ int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata,
if (need_basic && basic_rates & BIT(i))
basic = 0x80;
- rate = sband->bitrates[i].bitrate;
rate = DIV_ROUND_UP(sband->bitrates[i].bitrate,
5 * (1 << shift));
*pos++ = basic | (u8) rate;
--
2.8.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/5] mac80211: remove pointless chanctx NULL check
2016-09-14 8:11 [PATCH 1/5] nl80211: always check nla_nest_start() return value Johannes Berg
2016-09-14 8:11 ` [PATCH 2/5] nl80211: always check nla_put* return values Johannes Berg
2016-09-14 8:11 ` [PATCH 3/5] mac80211: remove unused assignment Johannes Berg
@ 2016-09-14 8:11 ` Johannes Berg
2016-09-14 8:11 ` [PATCH 5/5] mac80211: remove sta_remove_debugfs driver callback Johannes Berg
3 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2016-09-14 8:11 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
If chanctx is derived as container_of() from a non-NULL pointer,
it can't ever be NULL. Since we checked conf before, that's true
here, so remove the useless NULL check.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/cfg.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 5d4afead804e..e29ff5749944 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2961,10 +2961,6 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
}
chanctx = container_of(conf, struct ieee80211_chanctx, conf);
- if (!chanctx) {
- err = -EBUSY;
- goto out;
- }
ch_switch.timestamp = 0;
ch_switch.device_timestamp = 0;
--
2.8.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 5/5] mac80211: remove sta_remove_debugfs driver callback
2016-09-14 8:11 [PATCH 1/5] nl80211: always check nla_nest_start() return value Johannes Berg
` (2 preceding siblings ...)
2016-09-14 8:11 ` [PATCH 4/5] mac80211: remove pointless chanctx NULL check Johannes Berg
@ 2016-09-14 8:11 ` Johannes Berg
3 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2016-09-14 8:11 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
No drivers implement this, relying either on the recursive
directory removal to remove their debugfs, or not having any
to start with. Remove the dead driver callback.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
include/net/mac80211.h | 11 ++---------
net/mac80211/debugfs_sta.c | 4 ----
net/mac80211/driver-ops.h | 15 ---------------
3 files changed, 2 insertions(+), 28 deletions(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 08bac23c8de1..d9c8ccd6b4e6 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3101,11 +3101,8 @@ enum ieee80211_reconfig_type {
*
* @sta_add_debugfs: Drivers can use this callback to add debugfs files
* when a station is added to mac80211's station list. This callback
- * and @sta_remove_debugfs should be within a CONFIG_MAC80211_DEBUGFS
- * conditional. This callback can sleep.
- *
- * @sta_remove_debugfs: Remove the debugfs files which were added using
- * @sta_add_debugfs. This callback can sleep.
+ * should be within a CONFIG_MAC80211_DEBUGFS conditional. This
+ * callback can sleep.
*
* @sta_notify: Notifies low level driver about power state transition of an
* associated station, AP, IBSS/WDS/mesh peer etc. For a VIF operating
@@ -3501,10 +3498,6 @@ struct ieee80211_ops {
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct dentry *dir);
- void (*sta_remove_debugfs)(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct ieee80211_sta *sta,
- struct dentry *dir);
#endif
void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
enum sta_notify_cmd, struct ieee80211_sta *sta);
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index fb2693582e40..a2fcdb47a0e6 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -544,10 +544,6 @@ void ieee80211_sta_debugfs_add(struct sta_info *sta)
void ieee80211_sta_debugfs_remove(struct sta_info *sta)
{
- struct ieee80211_local *local = sta->local;
- struct ieee80211_sub_if_data *sdata = sta->sdata;
-
- drv_sta_remove_debugfs(local, sdata, &sta->sta, sta->debugfs_dir);
debugfs_remove_recursive(sta->debugfs_dir);
sta->debugfs_dir = NULL;
}
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index c39f93b48791..fe35a1c0dc86 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -499,21 +499,6 @@ static inline void drv_sta_add_debugfs(struct ieee80211_local *local,
local->ops->sta_add_debugfs(&local->hw, &sdata->vif,
sta, dir);
}
-
-static inline void drv_sta_remove_debugfs(struct ieee80211_local *local,
- struct ieee80211_sub_if_data *sdata,
- struct ieee80211_sta *sta,
- struct dentry *dir)
-{
- might_sleep();
-
- sdata = get_bss_sdata(sdata);
- check_sdata_in_driver(sdata);
-
- if (local->ops->sta_remove_debugfs)
- local->ops->sta_remove_debugfs(&local->hw, &sdata->vif,
- sta, dir);
-}
#endif
static inline void drv_sta_pre_rcu_remove(struct ieee80211_local *local,
--
2.8.1
^ permalink raw reply related [flat|nested] 5+ messages in thread