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

Commit 8c5bb1fa authored by Johannes Berg's avatar Johannes Berg
Browse files

mac80211: remove BUG_ON usage



These BUG_ON statements should never trigger, but in the unlikely
event that somebody does manage don't stop everything but simply
exit the code path with an error.

Leave the one BUG_ON where changing it would result in a NULL
pointer dereference.

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 2fd05115
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -325,7 +325,8 @@ ieee80211_key_alloc(u32 cipher, int idx, size_t key_len,
	struct ieee80211_key *key;
	struct ieee80211_key *key;
	int i, j, err;
	int i, j, err;


	BUG_ON(idx < 0 || idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS);
	if (WARN_ON(idx < 0 || idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS))
		return ERR_PTR(-EINVAL);


	key = kzalloc(sizeof(struct ieee80211_key) + key_len, GFP_KERNEL);
	key = kzalloc(sizeof(struct ieee80211_key) + key_len, GFP_KERNEL);
	if (!key)
	if (!key)
@@ -481,8 +482,8 @@ int ieee80211_key_link(struct ieee80211_key *key,
	int idx, ret;
	int idx, ret;
	bool pairwise;
	bool pairwise;


	BUG_ON(!sdata);
	if (WARN_ON(!sdata || !key))
	BUG_ON(!key);
		return -EINVAL;


	pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE;
	pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE;
	idx = key->conf.keyidx;
	idx = key->conf.keyidx;
+4 −2
Original line number Original line Diff line number Diff line
@@ -287,8 +287,10 @@ static void mesh_path_move_to_queue(struct mesh_path *gate_mpath,
	struct sk_buff_head failq;
	struct sk_buff_head failq;
	unsigned long flags;
	unsigned long flags;


	BUG_ON(gate_mpath == from_mpath);
	if (WARN_ON(gate_mpath == from_mpath))
	BUG_ON(!gate_mpath->next_hop);
		return;
	if (WARN_ON(!gate_mpath->next_hop))
		return;


	__skb_queue_head_init(&failq);
	__skb_queue_head_init(&failq);


+1 −1
Original line number Original line Diff line number Diff line
@@ -171,7 +171,7 @@ static void mesh_sync_offset_adjust_tbtt(struct ieee80211_sub_if_data *sdata,
	u8 cap;
	u8 cap;


	WARN_ON(ifmsh->mesh_sp_id != IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET);
	WARN_ON(ifmsh->mesh_sp_id != IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET);
	BUG_ON(!rcu_read_lock_held());
	WARN_ON(!rcu_read_lock_held());
	cap = beacon->meshconf->meshconf_cap;
	cap = beacon->meshconf->meshconf_cap;


	spin_lock_bh(&ifmsh->sync_offset_lock);
	spin_lock_bh(&ifmsh->sync_offset_lock);