diff options
author | Johannes Berg <johannes.berg@intel.com> | 2014-04-29 11:55:26 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-04-29 11:59:27 -0400 |
commit | 8c5bb1fad0bb9c29f7d817c1e2fdb052b76f04e9 (patch) | |
tree | 367302bae08e527e1ede890d8674dc9077b83e7e /net/mac80211 | |
parent | 2fd0511556538a2d713e7a3d032c51cfe0117642 (diff) |
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: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/key.c | 7 | ||||
-rw-r--r-- | net/mac80211/mesh_pathtbl.c | 6 | ||||
-rw-r--r-- | net/mac80211/mesh_sync.c | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 6ff65a1ebaa9..16d97f044a20 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -325,7 +325,8 @@ ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, | |||
325 | struct ieee80211_key *key; | 325 | struct ieee80211_key *key; |
326 | int i, j, err; | 326 | int i, j, err; |
327 | 327 | ||
328 | BUG_ON(idx < 0 || idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS); | 328 | if (WARN_ON(idx < 0 || idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS)) |
329 | return ERR_PTR(-EINVAL); | ||
329 | 330 | ||
330 | key = kzalloc(sizeof(struct ieee80211_key) + key_len, GFP_KERNEL); | 331 | key = kzalloc(sizeof(struct ieee80211_key) + key_len, GFP_KERNEL); |
331 | if (!key) | 332 | if (!key) |
@@ -481,8 +482,8 @@ int ieee80211_key_link(struct ieee80211_key *key, | |||
481 | int idx, ret; | 482 | int idx, ret; |
482 | bool pairwise; | 483 | bool pairwise; |
483 | 484 | ||
484 | BUG_ON(!sdata); | 485 | if (WARN_ON(!sdata || !key)) |
485 | BUG_ON(!key); | 486 | return -EINVAL; |
486 | 487 | ||
487 | pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE; | 488 | pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE; |
488 | idx = key->conf.keyidx; | 489 | idx = key->conf.keyidx; |
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 7d050ed6fe5a..cf032a8db9d7 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c | |||
@@ -287,8 +287,10 @@ static void mesh_path_move_to_queue(struct mesh_path *gate_mpath, | |||
287 | struct sk_buff_head failq; | 287 | struct sk_buff_head failq; |
288 | unsigned long flags; | 288 | unsigned long flags; |
289 | 289 | ||
290 | BUG_ON(gate_mpath == from_mpath); | 290 | if (WARN_ON(gate_mpath == from_mpath)) |
291 | BUG_ON(!gate_mpath->next_hop); | 291 | return; |
292 | if (WARN_ON(!gate_mpath->next_hop)) | ||
293 | return; | ||
292 | 294 | ||
293 | __skb_queue_head_init(&failq); | 295 | __skb_queue_head_init(&failq); |
294 | 296 | ||
diff --git a/net/mac80211/mesh_sync.c b/net/mac80211/mesh_sync.c index 2bc5dc25d5ad..09625d6205c3 100644 --- a/net/mac80211/mesh_sync.c +++ b/net/mac80211/mesh_sync.c | |||
@@ -171,7 +171,7 @@ static void mesh_sync_offset_adjust_tbtt(struct ieee80211_sub_if_data *sdata, | |||
171 | u8 cap; | 171 | u8 cap; |
172 | 172 | ||
173 | WARN_ON(ifmsh->mesh_sp_id != IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET); | 173 | WARN_ON(ifmsh->mesh_sp_id != IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET); |
174 | BUG_ON(!rcu_read_lock_held()); | 174 | WARN_ON(!rcu_read_lock_held()); |
175 | cap = beacon->meshconf->meshconf_cap; | 175 | cap = beacon->meshconf->meshconf_cap; |
176 | 176 | ||
177 | spin_lock_bh(&ifmsh->sync_offset_lock); | 177 | spin_lock_bh(&ifmsh->sync_offset_lock); |