Commit 03395003bf8ac813b1a0ac9299b3496484caf228

Authored by Johannes Berg
1 parent 65f704a52e

mac80211: use spin_lock_bh() for TKIP lock

Since no driver calls the TKIP functions from interrupt
context, there's no need to use spin_lock_irqsave().
Just use spin_lock_bh() (and spin_lock() in the TX path
where we're in a BH or they're already disabled.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Showing 2 changed files with 6 additions and 9 deletions Side-by-side Diff

... ... @@ -177,12 +177,11 @@
177 177 struct ieee80211_key *key = (struct ieee80211_key *)
178 178 container_of(keyconf, struct ieee80211_key, conf);
179 179 struct tkip_ctx *ctx = &key->u.tkip.tx;
180   - unsigned long flags;
181 180  
182   - spin_lock_irqsave(&key->u.tkip.txlock, flags);
  181 + spin_lock_bh(&key->u.tkip.txlock);
183 182 ieee80211_compute_tkip_p1k(key, iv32);
184 183 memcpy(p1k, ctx->p1k, sizeof(ctx->p1k));
185   - spin_unlock_irqrestore(&key->u.tkip.txlock, flags);
  184 + spin_unlock_bh(&key->u.tkip.txlock);
186 185 }
187 186 EXPORT_SYMBOL(ieee80211_get_tkip_p1k_iv);
188 187  
189 188  
190 189  
... ... @@ -208,12 +207,11 @@
208 207 const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control);
209 208 u32 iv32 = get_unaligned_le32(&data[4]);
210 209 u16 iv16 = data[2] | (data[0] << 8);
211   - unsigned long flags;
212 210  
213   - spin_lock_irqsave(&key->u.tkip.txlock, flags);
  211 + spin_lock_bh(&key->u.tkip.txlock);
214 212 ieee80211_compute_tkip_p1k(key, iv32);
215 213 tkip_mixing_phase2(tk, ctx, iv16, p2k);
216   - spin_unlock_irqrestore(&key->u.tkip.txlock, flags);
  214 + spin_unlock_bh(&key->u.tkip.txlock);
217 215 }
218 216 EXPORT_SYMBOL(ieee80211_get_tkip_p2k);
219 217  
... ... @@ -181,7 +181,6 @@
181 181 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
182 182 struct ieee80211_key *key = tx->key;
183 183 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
184   - unsigned long flags;
185 184 unsigned int hdrlen;
186 185 int len, tail;
187 186 u8 *pos;
188 187  
... ... @@ -216,12 +215,12 @@
216 215 return 0;
217 216  
218 217 /* Increase IV for the frame */
219   - spin_lock_irqsave(&key->u.tkip.txlock, flags);
  218 + spin_lock(&key->u.tkip.txlock);
220 219 key->u.tkip.tx.iv16++;
221 220 if (key->u.tkip.tx.iv16 == 0)
222 221 key->u.tkip.tx.iv32++;
223 222 pos = ieee80211_tkip_add_iv(pos, key);
224   - spin_unlock_irqrestore(&key->u.tkip.txlock, flags);
  223 + spin_unlock(&key->u.tkip.txlock);
225 224  
226 225 /* hwaccel - with software IV */
227 226 if (info->control.hw_key)