All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] FILS discovery and bcast probe resp support
@ 2020-05-22 22:19 Aloka Dixit
  2020-05-22 22:19 ` [PATCH 1/2] nl80211: FILS discovery/bcast " Aloka Dixit
  2020-05-22 22:19 ` [PATCH 2/2] mac80211: FILS disc/bcast probe resp config Aloka Dixit
  0 siblings, 2 replies; 9+ messages in thread
From: Aloka Dixit @ 2020-05-22 22:19 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Aloka Dixit

This patchset adds support for FILS discovery and broadcast
unsolicited probe response transmission in 6GHz for in-band
discovery.

Aloka Dixit (2):
  nl80211: FILS discovery/bcast probe resp support
  mac80211: FILS disc/bcast probe resp config

 include/net/cfg80211.h       | 26 ++++++++++++++++
 include/net/mac80211.h       | 17 +++++++++++
 include/uapi/linux/nl80211.h | 27 +++++++++++++++++
 net/mac80211/cfg.c           | 57 +++++++++++++++++++++++++++++++++++
 net/mac80211/ieee80211_i.h   |  8 +++++
 net/mac80211/tx.c            | 30 +++++++++++++++++++
 net/wireless/nl80211.c       | 58 ++++++++++++++++++++++++++++++++++++
 7 files changed, 223 insertions(+)

-- 
2.25.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] nl80211: FILS discovery/bcast probe resp support
  2020-05-22 22:19 [PATCH 0/2] FILS discovery and bcast probe resp support Aloka Dixit
@ 2020-05-22 22:19 ` Aloka Dixit
  2020-05-25  7:52     ` kbuild test robot
  2020-05-26 14:45     ` Dan Carpenter
  2020-05-22 22:19 ` [PATCH 2/2] mac80211: FILS disc/bcast probe resp config Aloka Dixit
  1 sibling, 2 replies; 9+ messages in thread
From: Aloka Dixit @ 2020-05-22 22:19 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Aloka Dixit

This patch adds new attribute, NL80211_ATTR_FD_BCASTPRESP_CFG
to configure FILS discovery and broadcast probe response in 6GHz
for in-band discovery.

Only one of the two is active at a time to reduce broadcast
packets over the air.

Maximum packet interval can be 20 TUs.
Packet interval set to 0 disables FILS discovery and broadcast
probe response transmission.

Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
---
 include/net/cfg80211.h       | 26 ++++++++++++++++
 include/uapi/linux/nl80211.h | 27 +++++++++++++++++
 net/wireless/nl80211.c       | 58 ++++++++++++++++++++++++++++++++++++
 3 files changed, 111 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index a82fc59a1d82..e4bc03947005 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -957,6 +957,8 @@ struct cfg80211_crypto_settings {
  * @assocresp_ies_len: length of assocresp_ies in octets
  * @probe_resp_len: length of probe response template (@probe_resp)
  * @probe_resp: probe response template (AP mode only)
+ * @bcast_presp: Broadcast probe response template (AP mode only)
+ * @fils_disc: FILS discovery template (AP mode only)
  * @ftm_responder: enable FTM responder functionality; -1 for no change
  *	(which also implies no change in LCI/civic location data)
  * @lci: Measurement Report element content, starting with Measurement Token
@@ -965,6 +967,8 @@ struct cfg80211_crypto_settings {
  *	Token (measurement type 11)
  * @lci_len: LCI data length
  * @civicloc_len: Civic location data length
+ * @bcast_presp_len: Broadcast probe response template length
+ * @fils_disc_len: FILS discovery template length
  */
 struct cfg80211_beacon_data {
 	const u8 *head, *tail;
@@ -974,6 +978,8 @@ struct cfg80211_beacon_data {
 	const u8 *probe_resp;
 	const u8 *lci;
 	const u8 *civicloc;
+	const u8 *bcast_presp;
+	const u8 *fils_disc;
 	s8 ftm_responder;
 
 	size_t head_len, tail_len;
@@ -983,6 +989,8 @@ struct cfg80211_beacon_data {
 	size_t probe_resp_len;
 	size_t lci_len;
 	size_t civicloc_len;
+	size_t bcast_presp_len;
+	size_t fils_disc_len;
 };
 
 struct mac_address {
@@ -1017,6 +1025,22 @@ struct cfg80211_bitrate_mask {
 	} control[NUM_NL80211_BANDS];
 };
 
+enum cfg80211_fd_bcastpresp_types {
+	CFG80211_TYPE_FILS_DISCOVERY = 1,
+	CFG80211_TYPE_BCAST_PROBE_RESP
+};
+
+/**
+ * struct cfg80211_fd_bcastpresp - FILS discovery/bcast probe response config
+ *
+ * @type: CFG80211_TYPE_FILS_DISCOVERY/CFG80211_TYPE_BCAST_PROBE_RESP
+ * @interval: FILS discovery/broadcast probe response interval in TUs
+ */
+struct cfg80211_fd_bcastpresp {
+	enum cfg80211_fd_bcastpresp_types type;
+	u32 interval;
+};
+
 /**
  * enum cfg80211_ap_settings_flags - AP settings flags
  *
@@ -1064,6 +1088,7 @@ enum cfg80211_ap_settings_flags {
  * @he_obss_pd: OBSS Packet Detection settings
  * @he_bss_color: BSS Color settings
  * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
+ * @fd_bcastpresp: FILS discovery and broadcast probe response configuration
  */
 struct cfg80211_ap_settings {
 	struct cfg80211_chan_def chandef;
@@ -1094,6 +1119,7 @@ struct cfg80211_ap_settings {
 	u32 flags;
 	struct ieee80211_he_obss_pd he_obss_pd;
 	struct cfg80211_he_bss_color he_bss_color;
+	struct cfg80211_fd_bcastpresp fd_bcastpresp;
 };
 
 /**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 9679d561f7d0..3d7bb5c61002 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2484,6 +2484,8 @@ enum nl80211_commands {
  * @NL80211_ATTR_RECEIVE_MULTICAST: multicast flag for the
  *	%NL80211_CMD_REGISTER_FRAME command, see the description there.
  *
+ * @NL80211_ATTR_FD_BCASTPRESP_CFG: FILS discovery/broadcast probe resp.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2961,6 +2963,8 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_RECEIVE_MULTICAST,
 
+	NL80211_ATTR_FD_BCASTPRESP_CFG,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
@@ -6848,4 +6852,27 @@ enum nl80211_iftype_akm_attributes {
 	NL80211_IFTYPE_AKM_ATTR_MAX = __NL80211_IFTYPE_AKM_ATTR_LAST - 1,
 };
 
+/**
+ * enum nl80211_fd_bcastpresp_attributes - FILS disc/bcast probe resp settings
+ * @__NL80211_FD_BCASTPRESP_ATTR_INVALID: Invalid
+ *
+ * @NL80211_FD_BCASTPRESP_ATTR_TYPE: 1-FILS discovery, 2-broadcast probe resp
+ * @NL80211_FD_BCASTPRESP_ATTR_INT: FILS disc/bcast probe resp interval in TUs
+ * @NL80211_FD_BCASTPRESP_ATTR_TMPL: FILS discovery/bcast probe resp template
+ *
+ * @__NL80211_FD_BCASTPRESP_ATTR_LAST: Internal
+ * @NL80211_FD_BCASTPRESP_ATTR_MAX: highest FD/bcast probe resp attribute
+ */
+enum nl80211_fd_bcastpresp_attributes {
+	__NL80211_FD_BCASTPRESP_ATTR_INVALID,
+
+	NL80211_FD_BCASTPRESP_ATTR_TYPE,
+	NL80211_FD_BCASTPRESP_ATTR_INT,
+	NL80211_FD_BCASTPRESP_ATTR_TMPL,
+
+	/* keep last */
+	__NL80211_FD_BCASTPRESP_ATTR_LAST,
+	NL80211_FD_BCASTPRESP_ATTR_MAX = __NL80211_FD_BCASTPRESP_ATTR_LAST - 1
+};
+
 #endif /* __LINUX_NL80211_H */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 3d27b24c68b2..da61344c8ca3 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -331,6 +331,14 @@ he_bss_color_policy[NL80211_HE_BSS_COLOR_ATTR_MAX + 1] = {
 	[NL80211_HE_BSS_COLOR_ATTR_PARTIAL] = { .type = NLA_FLAG },
 };
 
+static const struct nla_policy
+fd_bcastpresp_policy[NL80211_FD_BCASTPRESP_ATTR_MAX + 1] = {
+	[NL80211_FD_BCASTPRESP_ATTR_TYPE] = NLA_POLICY_RANGE(NLA_U8, 1, 2),
+	[NL80211_FD_BCASTPRESP_ATTR_INT] = NLA_POLICY_MAX(NLA_U32, 20),
+	[NL80211_FD_BCASTPRESP_ATTR_TMPL] = { .type = NLA_BINARY,
+					      .len = IEEE80211_MAX_DATA_LEN },
+};
+
 static const struct nla_policy
 nl80211_tid_config_attr_policy[NL80211_TID_CONFIG_ATTR_MAX + 1] = {
 	[NL80211_TID_CONFIG_ATTR_VIF_SUPP] = { .type = NLA_U64 },
@@ -662,6 +670,8 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
 	[NL80211_ATTR_PMK_LIFETIME] = NLA_POLICY_MIN(NLA_U32, 1),
 	[NL80211_ATTR_PMK_REAUTH_THRESHOLD] = NLA_POLICY_RANGE(NLA_U8, 1, 100),
 	[NL80211_ATTR_RECEIVE_MULTICAST] = { .type = NLA_FLAG },
+	[NL80211_ATTR_FD_BCASTPRESP_CFG] =
+				NLA_POLICY_NESTED(fd_bcastpresp_policy),
 };
 
 /* policy for the key attributes */
@@ -4725,6 +4735,48 @@ static int nl80211_parse_he_bss_color(struct nlattr *attrs,
 	return 0;
 }
 
+static int nl80211_parse_fd_bcastpresp(struct genl_info *info,
+				       struct cfg80211_ap_settings *params)
+{
+	struct nlattr *tmpl;
+	struct nlattr *tb[NL80211_FD_BCASTPRESP_ATTR_MAX + 1];
+	int ret;
+	struct cfg80211_beacon_data *beacon = &params->beacon;
+	struct cfg80211_fd_bcastpresp *cfg;
+
+	if (params->chandef.center_freq1 <= 5940 &&
+	    params->chandef.center_freq1 >= 7105)
+		return -EOPNOTSUPP;
+
+	ret = nla_parse_nested(tb, NL80211_FD_BCASTPRESP_ATTR_MAX,
+			       info->attrs[NL80211_ATTR_FD_BCASTPRESP_CFG],
+			       fd_bcastpresp_policy, NULL);
+	if (ret)
+		return ret;
+
+	if (!tb[NL80211_FD_BCASTPRESP_ATTR_TYPE] ||
+	    !tb[NL80211_FD_BCASTPRESP_ATTR_INT])
+		return -EINVAL;
+
+	cfg = &params->fd_bcastpresp;
+	cfg->type = nla_get_u8(tb[NL80211_FD_BCASTPRESP_ATTR_TYPE]);
+	cfg->interval = nla_get_u32(tb[NL80211_FD_BCASTPRESP_ATTR_INT]);
+
+	tmpl = tb[NL80211_FD_BCASTPRESP_ATTR_TMPL];
+	if (!tmpl && !beacon->fils_disc_len && !beacon->bcast_presp_len)
+		return -EINVAL;
+
+	if (cfg->type == CFG80211_TYPE_FILS_DISCOVERY) {
+		beacon->fils_disc = nla_data(tmpl);
+		beacon->fils_disc_len = nla_len(tmpl);
+	} else if (cfg->type == CFG80211_TYPE_BCAST_PROBE_RESP) {
+		beacon->bcast_presp = nla_data(tmpl);
+		beacon->bcast_presp_len = nla_len(tmpl);
+	}
+
+	return 0;
+}
+
 static void nl80211_check_ap_rate_selectors(struct cfg80211_ap_settings *params,
 					    const u8 *rates)
 {
@@ -5029,6 +5081,12 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
 			return err;
 	}
 
+	if (info->attrs[NL80211_ATTR_FD_BCASTPRESP_CFG]) {
+		err = nl80211_parse_fd_bcastpresp(info, &params);
+		if (err)
+			return err;
+	}
+
 	nl80211_calculate_ap_params(&params);
 
 	if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] mac80211: FILS disc/bcast probe resp config
  2020-05-22 22:19 [PATCH 0/2] FILS discovery and bcast probe resp support Aloka Dixit
  2020-05-22 22:19 ` [PATCH 1/2] nl80211: FILS discovery/bcast " Aloka Dixit
@ 2020-05-22 22:19 ` Aloka Dixit
  1 sibling, 0 replies; 9+ messages in thread
From: Aloka Dixit @ 2020-05-22 22:19 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Aloka Dixit

This patch adds mac80211 support to configure FILS discovery and
broadcast probe response in 6GHz for in-band discovery.

Changes include functions to store and retrieve FILS discovery,
broadcast probe response templates, and packet interval.

Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
---
 include/net/mac80211.h     | 17 ++++++++++++
 net/mac80211/cfg.c         | 57 ++++++++++++++++++++++++++++++++++++++
 net/mac80211/ieee80211_i.h |  8 ++++++
 net/mac80211/tx.c          | 30 ++++++++++++++++++++
 4 files changed, 112 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 78f7ce586287..768d6d9c47b6 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -317,6 +317,7 @@ struct ieee80211_vif_chanctx_switch {
  * @BSS_CHANGED_TWT: TWT status changed
  * @BSS_CHANGED_HE_OBSS_PD: OBSS Packet Detection status changed.
  * @BSS_CHANGED_HE_BSS_COLOR: BSS Color has changed
+ * @BSS_CHANGED_FD_BCASTPRESP: FILS Discovery/Bcast probe resp status changed.
  *
  */
 enum ieee80211_bss_change {
@@ -350,6 +351,7 @@ enum ieee80211_bss_change {
 	BSS_CHANGED_TWT			= 1<<27,
 	BSS_CHANGED_HE_OBSS_PD		= 1<<28,
 	BSS_CHANGED_HE_BSS_COLOR	= 1<<29,
+	BSS_CHANGED_FD_BCASTPRESP	= 1<<30,
 
 	/* when adding here, make sure to change ieee80211_reconfig */
 };
@@ -607,6 +609,7 @@ struct ieee80211_ftm_responder_params {
  * @he_oper: HE operation information of the AP we are connected to
  * @he_obss_pd: OBSS Packet Detection parameters.
  * @he_bss_color: BSS coloring settings, if BSS supports HE
+ * @fd_bcastpresp: FILS discovery and broadcast probe response configuration
  */
 struct ieee80211_bss_conf {
 	const u8 *bssid;
@@ -674,6 +677,7 @@ struct ieee80211_bss_conf {
 	} he_oper;
 	struct ieee80211_he_obss_pd he_obss_pd;
 	struct cfg80211_he_bss_color he_bss_color;
+	struct cfg80211_fd_bcastpresp fd_bcastpresp;
 };
 
 /**
@@ -6554,4 +6558,17 @@ u32 ieee80211_calc_tx_airtime(struct ieee80211_hw *hw,
  */
 bool ieee80211_set_hw_80211_encap(struct ieee80211_vif *vif, bool enable);
 
+/**
+ * ieee80211_get_fd_bcastpresp_tmpl - Get FILS disc/Bcast probe resp template.
+ * @hw: pointer obtained from ieee80211_alloc_hw().
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+ * @config: 1-FILS discovery, 2-Broadcast probe response.
+ *
+ * The driver is responsible for freeing the returned skb.
+ *
+ * Return: FILS discovery/broadcast probe response template. %NULL on error.
+ */
+struct sk_buff *ieee80211_get_fd_bcastpresp_tmpl(struct ieee80211_hw *hw,
+						 struct ieee80211_vif *vif,
+						 u8 config);
 #endif /* MAC80211_H */
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 548a384b0509..234f2610256c 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -837,6 +837,43 @@ static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
 	return 0;
 }
 
+static int ieee80211_set_fd_bcastpresp(struct ieee80211_sub_if_data *sdata,
+				       struct cfg80211_ap_settings *params)
+{
+	struct fd_bcastpresp *new, *old = NULL;
+	struct cfg80211_fd_bcastpresp *cfg;
+	struct cfg80211_beacon_data *bcn = &params->beacon;
+
+	cfg = &sdata->vif.bss_conf.fd_bcastpresp;
+	cfg->type = params->fd_bcastpresp.type;
+	cfg->interval = params->fd_bcastpresp.interval;
+
+	if (cfg->type == CFG80211_TYPE_FILS_DISCOVERY && bcn->fils_disc_len) {
+		new = kzalloc(sizeof(*new) + bcn->fils_disc_len, GFP_KERNEL);
+		if (!new)
+			return -ENOMEM;
+		new->len = bcn->fils_disc_len;
+		memcpy(new->data, bcn->fils_disc, bcn->fils_disc_len);
+		old = sdata_dereference(sdata->u.ap.fils_disc, sdata);
+		rcu_assign_pointer(sdata->u.ap.fils_disc, new);
+	} else if (cfg->type == CFG80211_TYPE_BCAST_PROBE_RESP &&
+		   bcn->bcast_presp_len) {
+		new = kzalloc(sizeof(*new) + bcn->bcast_presp_len, GFP_KERNEL);
+		if (!new)
+			return -ENOMEM;
+		new->len = bcn->bcast_presp_len;
+		memcpy(new->data, bcn->bcast_presp,
+		       bcn->bcast_presp_len);
+		old = sdata_dereference(sdata->u.ap.bcast_presp, sdata);
+		rcu_assign_pointer(sdata->u.ap.bcast_presp, new);
+	}
+
+	if (old)
+		kfree_rcu(old, rcu_head);
+
+	return 0;
+}
+
 static int ieee80211_set_ftm_responder_params(
 				struct ieee80211_sub_if_data *sdata,
 				const u8 *lci, size_t lci_len,
@@ -1103,6 +1140,16 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
 	}
 	changed |= err;
 
+	if (params->fd_bcastpresp.type) {
+		err = ieee80211_set_fd_bcastpresp(sdata, params);
+		if (err < 0) {
+			ieee80211_vif_release_channel(sdata);
+			return err;
+		} else if (err == 0) {
+			changed |= BSS_CHANGED_FD_BCASTPRESP;
+		}
+	}
+
 	err = drv_start_ap(sdata->local, sdata);
 	if (err) {
 		old = sdata_dereference(sdata->u.ap.beacon, sdata);
@@ -1158,6 +1205,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
 	struct ieee80211_local *local = sdata->local;
 	struct beacon_data *old_beacon;
 	struct probe_resp *old_probe_resp;
+	struct fd_bcastpresp *old_bcast_probe_resp, *old_fils_disc;
 	struct cfg80211_chan_def chandef;
 
 	sdata_assert_lock(sdata);
@@ -1166,6 +1214,9 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
 	if (!old_beacon)
 		return -ENOENT;
 	old_probe_resp = sdata_dereference(sdata->u.ap.probe_resp, sdata);
+	old_bcast_probe_resp = sdata_dereference(sdata->u.ap.bcast_presp,
+						 sdata);
+	old_fils_disc = sdata_dereference(sdata->u.ap.fils_disc, sdata);
 
 	/* abort any running channel switch */
 	mutex_lock(&local->mtx);
@@ -1189,9 +1240,15 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
 	/* remove beacon and probe response */
 	RCU_INIT_POINTER(sdata->u.ap.beacon, NULL);
 	RCU_INIT_POINTER(sdata->u.ap.probe_resp, NULL);
+	RCU_INIT_POINTER(sdata->u.ap.bcast_presp, NULL);
+	RCU_INIT_POINTER(sdata->u.ap.fils_disc, NULL);
 	kfree_rcu(old_beacon, rcu_head);
 	if (old_probe_resp)
 		kfree_rcu(old_probe_resp, rcu_head);
+	if (old_bcast_probe_resp)
+		kfree_rcu(old_bcast_probe_resp, rcu_head);
+	if (old_fils_disc)
+		kfree_rcu(old_fils_disc, rcu_head);
 
 	kfree(sdata->vif.bss_conf.ftmr_params);
 	sdata->vif.bss_conf.ftmr_params = NULL;
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 8cbae66b5cdb..f9c77dbeb29a 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -270,6 +270,12 @@ struct probe_resp {
 	u8 data[0];
 };
 
+struct fd_bcastpresp {
+	struct rcu_head rcu_head;
+	int len;
+	u8 data[0];
+};
+
 struct ps_data {
 	/* yes, this looks ugly, but guarantees that we can later use
 	 * bitmap_empty :)
@@ -285,6 +291,8 @@ struct ps_data {
 struct ieee80211_if_ap {
 	struct beacon_data __rcu *beacon;
 	struct probe_resp __rcu *probe_resp;
+	struct fd_bcastpresp __rcu *bcast_presp;
+	struct fd_bcastpresp __rcu *fils_disc;
 
 	/* to be used after channel switch. */
 	struct cfg80211_beacon_data *next_beacon;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 6dad67eb60b2..6dacd58d956d 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -4984,6 +4984,36 @@ struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw,
 }
 EXPORT_SYMBOL(ieee80211_proberesp_get);
 
+struct sk_buff *ieee80211_get_fd_bcastpresp_tmpl(struct ieee80211_hw *hw,
+						 struct ieee80211_vif *vif,
+						 u8 config)
+{
+	struct sk_buff *skb = NULL;
+	struct fd_bcastpresp *tmpl = NULL;
+	struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+
+	if (sdata->vif.type != NL80211_IFTYPE_AP)
+		return NULL;
+
+	rcu_read_lock();
+
+	if (config == CFG80211_TYPE_FILS_DISCOVERY)
+		tmpl = rcu_dereference(sdata->u.ap.fils_disc);
+	else if (config == CFG80211_TYPE_BCAST_PROBE_RESP)
+		tmpl = rcu_dereference(sdata->u.ap.bcast_presp);
+
+	if (!tmpl || !tmpl->len)
+		goto out;
+
+	skb = dev_alloc_skb(tmpl->len);
+	if (skb)
+		skb_put_data(skb, tmpl->data, tmpl->len);
+out:
+	rcu_read_unlock();
+	return skb;
+}
+EXPORT_SYMBOL(ieee80211_get_fd_bcastpresp_tmpl);
+
 struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,
 				     struct ieee80211_vif *vif)
 {
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] nl80211: FILS discovery/bcast probe resp support
  2020-05-22 22:19 ` [PATCH 1/2] nl80211: FILS discovery/bcast " Aloka Dixit
@ 2020-05-25  7:52     ` kbuild test robot
  2020-05-26 14:45     ` Dan Carpenter
  1 sibling, 0 replies; 9+ messages in thread
From: kbuild test robot @ 2020-05-25  7:52 UTC (permalink / raw)
  To: Aloka Dixit, johannes
  Cc: kbuild-all, clang-built-linux, linux-wireless, Aloka Dixit

[-- Attachment #1: Type: text/plain, Size: 3367 bytes --]

Hi Aloka,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on next-20200522]
[cannot apply to mac80211/master v5.7-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Aloka-Dixit/FILS-discovery-and-bcast-probe-resp-support/20200523-062228
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: arm-randconfig-r024-20200524 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 3393cc4cebf9969db94dc424b7a2b6195589c33b)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> net/wireless/nl80211.c:4747:43: warning: overlapping comparisons always evaluate to false [-Wtautological-overlap-compare]
if (params->chandef.center_freq1 <= 5940 &&
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
1 warning generated.

vim +4747 net/wireless/nl80211.c

  4737	
  4738	static int nl80211_parse_fd_bcastpresp(struct genl_info *info,
  4739					       struct cfg80211_ap_settings *params)
  4740	{
  4741		struct nlattr *tmpl;
  4742		struct nlattr *tb[NL80211_FD_BCASTPRESP_ATTR_MAX + 1];
  4743		int ret;
  4744		struct cfg80211_beacon_data *beacon = &params->beacon;
  4745		struct cfg80211_fd_bcastpresp *cfg;
  4746	
> 4747		if (params->chandef.center_freq1 <= 5940 &&
  4748		    params->chandef.center_freq1 >= 7105)
  4749			return -EOPNOTSUPP;
  4750	
  4751		ret = nla_parse_nested(tb, NL80211_FD_BCASTPRESP_ATTR_MAX,
  4752				       info->attrs[NL80211_ATTR_FD_BCASTPRESP_CFG],
  4753				       fd_bcastpresp_policy, NULL);
  4754		if (ret)
  4755			return ret;
  4756	
  4757		if (!tb[NL80211_FD_BCASTPRESP_ATTR_TYPE] ||
  4758		    !tb[NL80211_FD_BCASTPRESP_ATTR_INT])
  4759			return -EINVAL;
  4760	
  4761		cfg = &params->fd_bcastpresp;
  4762		cfg->type = nla_get_u8(tb[NL80211_FD_BCASTPRESP_ATTR_TYPE]);
  4763		cfg->interval = nla_get_u32(tb[NL80211_FD_BCASTPRESP_ATTR_INT]);
  4764	
  4765		tmpl = tb[NL80211_FD_BCASTPRESP_ATTR_TMPL];
  4766		if (!tmpl && !beacon->fils_disc_len && !beacon->bcast_presp_len)
  4767			return -EINVAL;
  4768	
  4769		if (cfg->type == CFG80211_TYPE_FILS_DISCOVERY) {
  4770			beacon->fils_disc = nla_data(tmpl);
  4771			beacon->fils_disc_len = nla_len(tmpl);
  4772		} else if (cfg->type == CFG80211_TYPE_BCAST_PROBE_RESP) {
  4773			beacon->bcast_presp = nla_data(tmpl);
  4774			beacon->bcast_presp_len = nla_len(tmpl);
  4775		}
  4776	
  4777		return 0;
  4778	}
  4779	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32740 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] nl80211: FILS discovery/bcast probe resp support
@ 2020-05-25  7:52     ` kbuild test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kbuild test robot @ 2020-05-25  7:52 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3451 bytes --]

Hi Aloka,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on next-20200522]
[cannot apply to mac80211/master v5.7-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Aloka-Dixit/FILS-discovery-and-bcast-probe-resp-support/20200523-062228
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: arm-randconfig-r024-20200524 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 3393cc4cebf9969db94dc424b7a2b6195589c33b)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> net/wireless/nl80211.c:4747:43: warning: overlapping comparisons always evaluate to false [-Wtautological-overlap-compare]
if (params->chandef.center_freq1 <= 5940 &&
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
1 warning generated.

vim +4747 net/wireless/nl80211.c

  4737	
  4738	static int nl80211_parse_fd_bcastpresp(struct genl_info *info,
  4739					       struct cfg80211_ap_settings *params)
  4740	{
  4741		struct nlattr *tmpl;
  4742		struct nlattr *tb[NL80211_FD_BCASTPRESP_ATTR_MAX + 1];
  4743		int ret;
  4744		struct cfg80211_beacon_data *beacon = &params->beacon;
  4745		struct cfg80211_fd_bcastpresp *cfg;
  4746	
> 4747		if (params->chandef.center_freq1 <= 5940 &&
  4748		    params->chandef.center_freq1 >= 7105)
  4749			return -EOPNOTSUPP;
  4750	
  4751		ret = nla_parse_nested(tb, NL80211_FD_BCASTPRESP_ATTR_MAX,
  4752				       info->attrs[NL80211_ATTR_FD_BCASTPRESP_CFG],
  4753				       fd_bcastpresp_policy, NULL);
  4754		if (ret)
  4755			return ret;
  4756	
  4757		if (!tb[NL80211_FD_BCASTPRESP_ATTR_TYPE] ||
  4758		    !tb[NL80211_FD_BCASTPRESP_ATTR_INT])
  4759			return -EINVAL;
  4760	
  4761		cfg = &params->fd_bcastpresp;
  4762		cfg->type = nla_get_u8(tb[NL80211_FD_BCASTPRESP_ATTR_TYPE]);
  4763		cfg->interval = nla_get_u32(tb[NL80211_FD_BCASTPRESP_ATTR_INT]);
  4764	
  4765		tmpl = tb[NL80211_FD_BCASTPRESP_ATTR_TMPL];
  4766		if (!tmpl && !beacon->fils_disc_len && !beacon->bcast_presp_len)
  4767			return -EINVAL;
  4768	
  4769		if (cfg->type == CFG80211_TYPE_FILS_DISCOVERY) {
  4770			beacon->fils_disc = nla_data(tmpl);
  4771			beacon->fils_disc_len = nla_len(tmpl);
  4772		} else if (cfg->type == CFG80211_TYPE_BCAST_PROBE_RESP) {
  4773			beacon->bcast_presp = nla_data(tmpl);
  4774			beacon->bcast_presp_len = nla_len(tmpl);
  4775		}
  4776	
  4777		return 0;
  4778	}
  4779	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32740 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] nl80211: FILS discovery/bcast probe resp support
  2020-05-22 22:19 ` [PATCH 1/2] nl80211: FILS discovery/bcast " Aloka Dixit
  2020-05-25  7:52     ` kbuild test robot
@ 2020-05-26 14:45     ` Dan Carpenter
  1 sibling, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2020-05-26 14:45 UTC (permalink / raw)
  To: kbuild, Aloka Dixit, johannes
  Cc: lkp, kbuild-all, linux-wireless, Aloka Dixit

[-- Attachment #1: Type: text/plain, Size: 4303 bytes --]

Hi Aloka,

url:    https://github.com/0day-ci/linux/commits/Aloka-Dixit/FILS-discovery-and-bcast-probe-resp-support/20200523-062228
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master

config: x86_64-defconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
net/wireless/nl80211.c:4771 nl80211_parse_fd_bcastpresp() error: we previously assumed 'tmpl' could be null (see line 4766)

# https://github.com/0day-ci/linux/commit/d7497e63c41decf82e86f11b0691e47e24b11122
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout d7497e63c41decf82e86f11b0691e47e24b11122
vim +/tmpl +4771 net/wireless/nl80211.c

d7497e63c41dec Aloka Dixit  2020-05-22  4738  static int nl80211_parse_fd_bcastpresp(struct genl_info *info,
d7497e63c41dec Aloka Dixit  2020-05-22  4739  				       struct cfg80211_ap_settings *params)
d7497e63c41dec Aloka Dixit  2020-05-22  4740  {
d7497e63c41dec Aloka Dixit  2020-05-22  4741  	struct nlattr *tmpl;
d7497e63c41dec Aloka Dixit  2020-05-22  4742  	struct nlattr *tb[NL80211_FD_BCASTPRESP_ATTR_MAX + 1];
d7497e63c41dec Aloka Dixit  2020-05-22  4743  	int ret;
d7497e63c41dec Aloka Dixit  2020-05-22  4744  	struct cfg80211_beacon_data *beacon = &params->beacon;
d7497e63c41dec Aloka Dixit  2020-05-22  4745  	struct cfg80211_fd_bcastpresp *cfg;
d7497e63c41dec Aloka Dixit  2020-05-22  4746  
d7497e63c41dec Aloka Dixit  2020-05-22  4747  	if (params->chandef.center_freq1 <= 5940 &&
d7497e63c41dec Aloka Dixit  2020-05-22  4748  	    params->chandef.center_freq1 >= 7105)
d7497e63c41dec Aloka Dixit  2020-05-22  4749  		return -EOPNOTSUPP;
d7497e63c41dec Aloka Dixit  2020-05-22  4750  
d7497e63c41dec Aloka Dixit  2020-05-22  4751  	ret = nla_parse_nested(tb, NL80211_FD_BCASTPRESP_ATTR_MAX,
d7497e63c41dec Aloka Dixit  2020-05-22  4752  			       info->attrs[NL80211_ATTR_FD_BCASTPRESP_CFG],
d7497e63c41dec Aloka Dixit  2020-05-22  4753  			       fd_bcastpresp_policy, NULL);
d7497e63c41dec Aloka Dixit  2020-05-22  4754  	if (ret)
d7497e63c41dec Aloka Dixit  2020-05-22  4755  		return ret;
d7497e63c41dec Aloka Dixit  2020-05-22  4756  
d7497e63c41dec Aloka Dixit  2020-05-22  4757  	if (!tb[NL80211_FD_BCASTPRESP_ATTR_TYPE] ||
d7497e63c41dec Aloka Dixit  2020-05-22  4758  	    !tb[NL80211_FD_BCASTPRESP_ATTR_INT])
d7497e63c41dec Aloka Dixit  2020-05-22  4759  		return -EINVAL;
d7497e63c41dec Aloka Dixit  2020-05-22  4760  
d7497e63c41dec Aloka Dixit  2020-05-22  4761  	cfg = &params->fd_bcastpresp;
d7497e63c41dec Aloka Dixit  2020-05-22  4762  	cfg->type = nla_get_u8(tb[NL80211_FD_BCASTPRESP_ATTR_TYPE]);
d7497e63c41dec Aloka Dixit  2020-05-22  4763  	cfg->interval = nla_get_u32(tb[NL80211_FD_BCASTPRESP_ATTR_INT]);
d7497e63c41dec Aloka Dixit  2020-05-22  4764  
d7497e63c41dec Aloka Dixit  2020-05-22  4765  	tmpl = tb[NL80211_FD_BCASTPRESP_ATTR_TMPL];
d7497e63c41dec Aloka Dixit  2020-05-22 @4766  	if (!tmpl && !beacon->fils_disc_len && !beacon->bcast_presp_len)

Should the && be ||?

d7497e63c41dec Aloka Dixit  2020-05-22  4767  		return -EINVAL;
d7497e63c41dec Aloka Dixit  2020-05-22  4768  
d7497e63c41dec Aloka Dixit  2020-05-22  4769  	if (cfg->type == CFG80211_TYPE_FILS_DISCOVERY) {
d7497e63c41dec Aloka Dixit  2020-05-22  4770  		beacon->fils_disc = nla_data(tmpl);
d7497e63c41dec Aloka Dixit  2020-05-22 @4771  		beacon->fils_disc_len = nla_len(tmpl);
                                                                                        ^^^^
Unchecked dereference.

d7497e63c41dec Aloka Dixit  2020-05-22  4772  	} else if (cfg->type == CFG80211_TYPE_BCAST_PROBE_RESP) {
d7497e63c41dec Aloka Dixit  2020-05-22  4773  		beacon->bcast_presp = nla_data(tmpl);
d7497e63c41dec Aloka Dixit  2020-05-22  4774  		beacon->bcast_presp_len = nla_len(tmpl);
d7497e63c41dec Aloka Dixit  2020-05-22  4775  	}
d7497e63c41dec Aloka Dixit  2020-05-22  4776  
d7497e63c41dec Aloka Dixit  2020-05-22  4777  	return 0;
d7497e63c41dec Aloka Dixit  2020-05-22  4778  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29124 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] nl80211: FILS discovery/bcast probe resp support
@ 2020-05-26 14:45     ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2020-05-26 14:45 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 4377 bytes --]

Hi Aloka,

url:    https://github.com/0day-ci/linux/commits/Aloka-Dixit/FILS-discovery-and-bcast-probe-resp-support/20200523-062228
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master

config: x86_64-defconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
net/wireless/nl80211.c:4771 nl80211_parse_fd_bcastpresp() error: we previously assumed 'tmpl' could be null (see line 4766)

# https://github.com/0day-ci/linux/commit/d7497e63c41decf82e86f11b0691e47e24b11122
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout d7497e63c41decf82e86f11b0691e47e24b11122
vim +/tmpl +4771 net/wireless/nl80211.c

d7497e63c41dec Aloka Dixit  2020-05-22  4738  static int nl80211_parse_fd_bcastpresp(struct genl_info *info,
d7497e63c41dec Aloka Dixit  2020-05-22  4739  				       struct cfg80211_ap_settings *params)
d7497e63c41dec Aloka Dixit  2020-05-22  4740  {
d7497e63c41dec Aloka Dixit  2020-05-22  4741  	struct nlattr *tmpl;
d7497e63c41dec Aloka Dixit  2020-05-22  4742  	struct nlattr *tb[NL80211_FD_BCASTPRESP_ATTR_MAX + 1];
d7497e63c41dec Aloka Dixit  2020-05-22  4743  	int ret;
d7497e63c41dec Aloka Dixit  2020-05-22  4744  	struct cfg80211_beacon_data *beacon = &params->beacon;
d7497e63c41dec Aloka Dixit  2020-05-22  4745  	struct cfg80211_fd_bcastpresp *cfg;
d7497e63c41dec Aloka Dixit  2020-05-22  4746  
d7497e63c41dec Aloka Dixit  2020-05-22  4747  	if (params->chandef.center_freq1 <= 5940 &&
d7497e63c41dec Aloka Dixit  2020-05-22  4748  	    params->chandef.center_freq1 >= 7105)
d7497e63c41dec Aloka Dixit  2020-05-22  4749  		return -EOPNOTSUPP;
d7497e63c41dec Aloka Dixit  2020-05-22  4750  
d7497e63c41dec Aloka Dixit  2020-05-22  4751  	ret = nla_parse_nested(tb, NL80211_FD_BCASTPRESP_ATTR_MAX,
d7497e63c41dec Aloka Dixit  2020-05-22  4752  			       info->attrs[NL80211_ATTR_FD_BCASTPRESP_CFG],
d7497e63c41dec Aloka Dixit  2020-05-22  4753  			       fd_bcastpresp_policy, NULL);
d7497e63c41dec Aloka Dixit  2020-05-22  4754  	if (ret)
d7497e63c41dec Aloka Dixit  2020-05-22  4755  		return ret;
d7497e63c41dec Aloka Dixit  2020-05-22  4756  
d7497e63c41dec Aloka Dixit  2020-05-22  4757  	if (!tb[NL80211_FD_BCASTPRESP_ATTR_TYPE] ||
d7497e63c41dec Aloka Dixit  2020-05-22  4758  	    !tb[NL80211_FD_BCASTPRESP_ATTR_INT])
d7497e63c41dec Aloka Dixit  2020-05-22  4759  		return -EINVAL;
d7497e63c41dec Aloka Dixit  2020-05-22  4760  
d7497e63c41dec Aloka Dixit  2020-05-22  4761  	cfg = &params->fd_bcastpresp;
d7497e63c41dec Aloka Dixit  2020-05-22  4762  	cfg->type = nla_get_u8(tb[NL80211_FD_BCASTPRESP_ATTR_TYPE]);
d7497e63c41dec Aloka Dixit  2020-05-22  4763  	cfg->interval = nla_get_u32(tb[NL80211_FD_BCASTPRESP_ATTR_INT]);
d7497e63c41dec Aloka Dixit  2020-05-22  4764  
d7497e63c41dec Aloka Dixit  2020-05-22  4765  	tmpl = tb[NL80211_FD_BCASTPRESP_ATTR_TMPL];
d7497e63c41dec Aloka Dixit  2020-05-22 @4766  	if (!tmpl && !beacon->fils_disc_len && !beacon->bcast_presp_len)

Should the && be ||?

d7497e63c41dec Aloka Dixit  2020-05-22  4767  		return -EINVAL;
d7497e63c41dec Aloka Dixit  2020-05-22  4768  
d7497e63c41dec Aloka Dixit  2020-05-22  4769  	if (cfg->type == CFG80211_TYPE_FILS_DISCOVERY) {
d7497e63c41dec Aloka Dixit  2020-05-22  4770  		beacon->fils_disc = nla_data(tmpl);
d7497e63c41dec Aloka Dixit  2020-05-22 @4771  		beacon->fils_disc_len = nla_len(tmpl);
                                                                                        ^^^^
Unchecked dereference.

d7497e63c41dec Aloka Dixit  2020-05-22  4772  	} else if (cfg->type == CFG80211_TYPE_BCAST_PROBE_RESP) {
d7497e63c41dec Aloka Dixit  2020-05-22  4773  		beacon->bcast_presp = nla_data(tmpl);
d7497e63c41dec Aloka Dixit  2020-05-22  4774  		beacon->bcast_presp_len = nla_len(tmpl);
d7497e63c41dec Aloka Dixit  2020-05-22  4775  	}
d7497e63c41dec Aloka Dixit  2020-05-22  4776  
d7497e63c41dec Aloka Dixit  2020-05-22  4777  	return 0;
d7497e63c41dec Aloka Dixit  2020-05-22  4778  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29124 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] nl80211: FILS discovery/bcast probe resp support
@ 2020-05-26 14:45     ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2020-05-26 14:45 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4377 bytes --]

Hi Aloka,

url:    https://github.com/0day-ci/linux/commits/Aloka-Dixit/FILS-discovery-and-bcast-probe-resp-support/20200523-062228
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master

config: x86_64-defconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
net/wireless/nl80211.c:4771 nl80211_parse_fd_bcastpresp() error: we previously assumed 'tmpl' could be null (see line 4766)

# https://github.com/0day-ci/linux/commit/d7497e63c41decf82e86f11b0691e47e24b11122
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout d7497e63c41decf82e86f11b0691e47e24b11122
vim +/tmpl +4771 net/wireless/nl80211.c

d7497e63c41dec Aloka Dixit  2020-05-22  4738  static int nl80211_parse_fd_bcastpresp(struct genl_info *info,
d7497e63c41dec Aloka Dixit  2020-05-22  4739  				       struct cfg80211_ap_settings *params)
d7497e63c41dec Aloka Dixit  2020-05-22  4740  {
d7497e63c41dec Aloka Dixit  2020-05-22  4741  	struct nlattr *tmpl;
d7497e63c41dec Aloka Dixit  2020-05-22  4742  	struct nlattr *tb[NL80211_FD_BCASTPRESP_ATTR_MAX + 1];
d7497e63c41dec Aloka Dixit  2020-05-22  4743  	int ret;
d7497e63c41dec Aloka Dixit  2020-05-22  4744  	struct cfg80211_beacon_data *beacon = &params->beacon;
d7497e63c41dec Aloka Dixit  2020-05-22  4745  	struct cfg80211_fd_bcastpresp *cfg;
d7497e63c41dec Aloka Dixit  2020-05-22  4746  
d7497e63c41dec Aloka Dixit  2020-05-22  4747  	if (params->chandef.center_freq1 <= 5940 &&
d7497e63c41dec Aloka Dixit  2020-05-22  4748  	    params->chandef.center_freq1 >= 7105)
d7497e63c41dec Aloka Dixit  2020-05-22  4749  		return -EOPNOTSUPP;
d7497e63c41dec Aloka Dixit  2020-05-22  4750  
d7497e63c41dec Aloka Dixit  2020-05-22  4751  	ret = nla_parse_nested(tb, NL80211_FD_BCASTPRESP_ATTR_MAX,
d7497e63c41dec Aloka Dixit  2020-05-22  4752  			       info->attrs[NL80211_ATTR_FD_BCASTPRESP_CFG],
d7497e63c41dec Aloka Dixit  2020-05-22  4753  			       fd_bcastpresp_policy, NULL);
d7497e63c41dec Aloka Dixit  2020-05-22  4754  	if (ret)
d7497e63c41dec Aloka Dixit  2020-05-22  4755  		return ret;
d7497e63c41dec Aloka Dixit  2020-05-22  4756  
d7497e63c41dec Aloka Dixit  2020-05-22  4757  	if (!tb[NL80211_FD_BCASTPRESP_ATTR_TYPE] ||
d7497e63c41dec Aloka Dixit  2020-05-22  4758  	    !tb[NL80211_FD_BCASTPRESP_ATTR_INT])
d7497e63c41dec Aloka Dixit  2020-05-22  4759  		return -EINVAL;
d7497e63c41dec Aloka Dixit  2020-05-22  4760  
d7497e63c41dec Aloka Dixit  2020-05-22  4761  	cfg = &params->fd_bcastpresp;
d7497e63c41dec Aloka Dixit  2020-05-22  4762  	cfg->type = nla_get_u8(tb[NL80211_FD_BCASTPRESP_ATTR_TYPE]);
d7497e63c41dec Aloka Dixit  2020-05-22  4763  	cfg->interval = nla_get_u32(tb[NL80211_FD_BCASTPRESP_ATTR_INT]);
d7497e63c41dec Aloka Dixit  2020-05-22  4764  
d7497e63c41dec Aloka Dixit  2020-05-22  4765  	tmpl = tb[NL80211_FD_BCASTPRESP_ATTR_TMPL];
d7497e63c41dec Aloka Dixit  2020-05-22 @4766  	if (!tmpl && !beacon->fils_disc_len && !beacon->bcast_presp_len)

Should the && be ||?

d7497e63c41dec Aloka Dixit  2020-05-22  4767  		return -EINVAL;
d7497e63c41dec Aloka Dixit  2020-05-22  4768  
d7497e63c41dec Aloka Dixit  2020-05-22  4769  	if (cfg->type == CFG80211_TYPE_FILS_DISCOVERY) {
d7497e63c41dec Aloka Dixit  2020-05-22  4770  		beacon->fils_disc = nla_data(tmpl);
d7497e63c41dec Aloka Dixit  2020-05-22 @4771  		beacon->fils_disc_len = nla_len(tmpl);
                                                                                        ^^^^
Unchecked dereference.

d7497e63c41dec Aloka Dixit  2020-05-22  4772  	} else if (cfg->type == CFG80211_TYPE_BCAST_PROBE_RESP) {
d7497e63c41dec Aloka Dixit  2020-05-22  4773  		beacon->bcast_presp = nla_data(tmpl);
d7497e63c41dec Aloka Dixit  2020-05-22  4774  		beacon->bcast_presp_len = nla_len(tmpl);
d7497e63c41dec Aloka Dixit  2020-05-22  4775  	}
d7497e63c41dec Aloka Dixit  2020-05-22  4776  
d7497e63c41dec Aloka Dixit  2020-05-22  4777  	return 0;
d7497e63c41dec Aloka Dixit  2020-05-22  4778  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29124 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] nl80211: FILS discovery/bcast probe resp support
@ 2020-05-25  5:05 kbuild test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kbuild test robot @ 2020-05-25  5:05 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 6173 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200522221921.19347-2-alokad@codeaurora.org>
References: <20200522221921.19347-2-alokad@codeaurora.org>
TO: Aloka Dixit <alokad@codeaurora.org>
TO: johannes(a)sipsolutions.net
CC: linux-wireless(a)vger.kernel.org
CC: Aloka Dixit <alokad@codeaurora.org>

Hi Aloka,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on next-20200522]
[cannot apply to mac80211/master v5.7-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Aloka-Dixit/FILS-discovery-and-bcast-probe-resp-support/20200523-062228
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: x86_64-defconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
net/wireless/nl80211.c:4771 nl80211_parse_fd_bcastpresp() error: we previously assumed 'tmpl' could be null (see line 4766)

Old smatch warnings:
net/wireless/nl80211.c:225 validate_beacon_head() warn: potential spectre issue 'elem->data' [r]
net/wireless/nl80211.c:244 validate_ie_attr() warn: potential spectre issue 'elem->data' [r]
net/wireless/nl80211.c:1262 nl80211_parse_connkeys() warn: ignoring unreachable code.
net/wireless/nl80211.c:4482 nl80211_parse_tx_bitrate_mask() warn: potential spectre issue 'rdev->wiphy.bands' [r] (local cap)
net/wireless/nl80211.c:4483 nl80211_parse_tx_bitrate_mask() warn: possible spectre second half.  'sband'
net/wireless/nl80211.c:4492 nl80211_parse_tx_bitrate_mask() warn: potential spectre issue 'mask->control' [w] (local cap)
net/wireless/nl80211.c:7984 nl80211_trigger_scan() warn: potential spectre issue 'wiphy->bands' [r] (local cap)
net/wireless/nl80211.c:7987 nl80211_trigger_scan() warn: potential spectre issue 'request->rates' [r] (local cap)
net/wireless/nl80211.c:8186 nl80211_parse_sched_scan_per_band_rssi() warn: potential spectre issue 'match_sets->per_band_rssi_thold' [w] (local cap)

# https://github.com/0day-ci/linux/commit/d7497e63c41decf82e86f11b0691e47e24b11122
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout d7497e63c41decf82e86f11b0691e47e24b11122
vim +/tmpl +4771 net/wireless/nl80211.c

5c5e52d1bb9625 John Crispin 2019-12-17  4737  
d7497e63c41dec Aloka Dixit  2020-05-22  4738  static int nl80211_parse_fd_bcastpresp(struct genl_info *info,
d7497e63c41dec Aloka Dixit  2020-05-22  4739  				       struct cfg80211_ap_settings *params)
d7497e63c41dec Aloka Dixit  2020-05-22  4740  {
d7497e63c41dec Aloka Dixit  2020-05-22  4741  	struct nlattr *tmpl;
d7497e63c41dec Aloka Dixit  2020-05-22  4742  	struct nlattr *tb[NL80211_FD_BCASTPRESP_ATTR_MAX + 1];
d7497e63c41dec Aloka Dixit  2020-05-22  4743  	int ret;
d7497e63c41dec Aloka Dixit  2020-05-22  4744  	struct cfg80211_beacon_data *beacon = &params->beacon;
d7497e63c41dec Aloka Dixit  2020-05-22  4745  	struct cfg80211_fd_bcastpresp *cfg;
d7497e63c41dec Aloka Dixit  2020-05-22  4746  
d7497e63c41dec Aloka Dixit  2020-05-22  4747  	if (params->chandef.center_freq1 <= 5940 &&
d7497e63c41dec Aloka Dixit  2020-05-22  4748  	    params->chandef.center_freq1 >= 7105)
d7497e63c41dec Aloka Dixit  2020-05-22  4749  		return -EOPNOTSUPP;
d7497e63c41dec Aloka Dixit  2020-05-22  4750  
d7497e63c41dec Aloka Dixit  2020-05-22  4751  	ret = nla_parse_nested(tb, NL80211_FD_BCASTPRESP_ATTR_MAX,
d7497e63c41dec Aloka Dixit  2020-05-22  4752  			       info->attrs[NL80211_ATTR_FD_BCASTPRESP_CFG],
d7497e63c41dec Aloka Dixit  2020-05-22  4753  			       fd_bcastpresp_policy, NULL);
d7497e63c41dec Aloka Dixit  2020-05-22  4754  	if (ret)
d7497e63c41dec Aloka Dixit  2020-05-22  4755  		return ret;
d7497e63c41dec Aloka Dixit  2020-05-22  4756  
d7497e63c41dec Aloka Dixit  2020-05-22  4757  	if (!tb[NL80211_FD_BCASTPRESP_ATTR_TYPE] ||
d7497e63c41dec Aloka Dixit  2020-05-22  4758  	    !tb[NL80211_FD_BCASTPRESP_ATTR_INT])
d7497e63c41dec Aloka Dixit  2020-05-22  4759  		return -EINVAL;
d7497e63c41dec Aloka Dixit  2020-05-22  4760  
d7497e63c41dec Aloka Dixit  2020-05-22  4761  	cfg = &params->fd_bcastpresp;
d7497e63c41dec Aloka Dixit  2020-05-22  4762  	cfg->type = nla_get_u8(tb[NL80211_FD_BCASTPRESP_ATTR_TYPE]);
d7497e63c41dec Aloka Dixit  2020-05-22  4763  	cfg->interval = nla_get_u32(tb[NL80211_FD_BCASTPRESP_ATTR_INT]);
d7497e63c41dec Aloka Dixit  2020-05-22  4764  
d7497e63c41dec Aloka Dixit  2020-05-22  4765  	tmpl = tb[NL80211_FD_BCASTPRESP_ATTR_TMPL];
d7497e63c41dec Aloka Dixit  2020-05-22 @4766  	if (!tmpl && !beacon->fils_disc_len && !beacon->bcast_presp_len)
d7497e63c41dec Aloka Dixit  2020-05-22  4767  		return -EINVAL;
d7497e63c41dec Aloka Dixit  2020-05-22  4768  
d7497e63c41dec Aloka Dixit  2020-05-22  4769  	if (cfg->type == CFG80211_TYPE_FILS_DISCOVERY) {
d7497e63c41dec Aloka Dixit  2020-05-22  4770  		beacon->fils_disc = nla_data(tmpl);
d7497e63c41dec Aloka Dixit  2020-05-22 @4771  		beacon->fils_disc_len = nla_len(tmpl);
d7497e63c41dec Aloka Dixit  2020-05-22  4772  	} else if (cfg->type == CFG80211_TYPE_BCAST_PROBE_RESP) {
d7497e63c41dec Aloka Dixit  2020-05-22  4773  		beacon->bcast_presp = nla_data(tmpl);
d7497e63c41dec Aloka Dixit  2020-05-22  4774  		beacon->bcast_presp_len = nla_len(tmpl);
d7497e63c41dec Aloka Dixit  2020-05-22  4775  	}
d7497e63c41dec Aloka Dixit  2020-05-22  4776  
d7497e63c41dec Aloka Dixit  2020-05-22  4777  	return 0;
d7497e63c41dec Aloka Dixit  2020-05-22  4778  }
d7497e63c41dec Aloka Dixit  2020-05-22  4779  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29124 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-05-26 14:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22 22:19 [PATCH 0/2] FILS discovery and bcast probe resp support Aloka Dixit
2020-05-22 22:19 ` [PATCH 1/2] nl80211: FILS discovery/bcast " Aloka Dixit
2020-05-25  7:52   ` kbuild test robot
2020-05-25  7:52     ` kbuild test robot
2020-05-26 14:45   ` Dan Carpenter
2020-05-26 14:45     ` Dan Carpenter
2020-05-26 14:45     ` Dan Carpenter
2020-05-22 22:19 ` [PATCH 2/2] mac80211: FILS disc/bcast probe resp config Aloka Dixit
2020-05-25  5:05 [PATCH 1/2] nl80211: FILS discovery/bcast probe resp support kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.