diff options
Diffstat (limited to 'net/ieee80211')
-rw-r--r-- | net/ieee80211/ieee80211_tx.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c index 2955b7aa5a38..f4f2a33973a7 100644 --- a/net/ieee80211/ieee80211_tx.c +++ b/net/ieee80211/ieee80211_tx.c | |||
@@ -157,11 +157,14 @@ static inline int ieee80211_encrypt_fragment(struct ieee80211_device *ieee, | |||
157 | struct ieee80211_crypt_data *crypt = ieee->crypt[ieee->tx_keyidx]; | 157 | struct ieee80211_crypt_data *crypt = ieee->crypt[ieee->tx_keyidx]; |
158 | int res; | 158 | int res; |
159 | 159 | ||
160 | if (crypt == NULL) | ||
161 | return -1; | ||
162 | |||
160 | /* To encrypt, frame format is: | 163 | /* To encrypt, frame format is: |
161 | * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */ | 164 | * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */ |
162 | atomic_inc(&crypt->refcnt); | 165 | atomic_inc(&crypt->refcnt); |
163 | res = 0; | 166 | res = 0; |
164 | if (crypt->ops->encrypt_mpdu) | 167 | if (crypt->ops && crypt->ops->encrypt_mpdu) |
165 | res = crypt->ops->encrypt_mpdu(frag, hdr_len, crypt->priv); | 168 | res = crypt->ops->encrypt_mpdu(frag, hdr_len, crypt->priv); |
166 | 169 | ||
167 | atomic_dec(&crypt->refcnt); | 170 | atomic_dec(&crypt->refcnt); |
@@ -264,9 +267,9 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
264 | encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && | 267 | encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && |
265 | ieee->sec.encrypt; | 268 | ieee->sec.encrypt; |
266 | 269 | ||
267 | host_encrypt = ieee->host_encrypt && encrypt; | 270 | host_encrypt = ieee->host_encrypt && encrypt && crypt; |
268 | host_encrypt_msdu = ieee->host_encrypt_msdu && encrypt; | 271 | host_encrypt_msdu = ieee->host_encrypt_msdu && encrypt && crypt; |
269 | host_build_iv = ieee->host_build_iv && encrypt; | 272 | host_build_iv = ieee->host_build_iv && encrypt && crypt; |
270 | 273 | ||
271 | if (!encrypt && ieee->ieee802_1x && | 274 | if (!encrypt && ieee->ieee802_1x && |
272 | ieee->drop_unencrypted && ether_type != ETH_P_PAE) { | 275 | ieee->drop_unencrypted && ether_type != ETH_P_PAE) { |