aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/wireless/hostap/hostap_ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_ioctl.c')
-rw-r--r--drivers/net/wireless/hostap/hostap_ioctl.c43
1 files changed, 9 insertions, 34 deletions
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
index 29aebb67909..c40fdf4c79d 100644
--- a/drivers/net/wireless/hostap/hostap_ioctl.c
+++ b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -116,32 +116,6 @@ static int prism2_get_name(struct net_device *dev,
}
-static void prism2_crypt_delayed_deinit(local_info_t *local,
- struct lib80211_crypt_data **crypt)
-{
- struct lib80211_crypt_data *tmp;
- unsigned long flags;
-
- tmp = *crypt;
- *crypt = NULL;
-
- if (tmp == NULL)
- return;
-
- /* must not run ops->deinit() while there may be pending encrypt or
- * decrypt operations. Use a list of delayed deinits to avoid needing
- * locking. */
-
- spin_lock_irqsave(&local->lock, flags);
- list_add(&tmp->list, &local->crypt_info.crypt_deinit_list);
- if (!timer_pending(&local->crypt_info.crypt_deinit_timer)) {
- local->crypt_info.crypt_deinit_timer.expires = jiffies + HZ;
- add_timer(&local->crypt_info.crypt_deinit_timer);
- }
- spin_unlock_irqrestore(&local->lock, flags);
-}
-
-
static int prism2_ioctl_siwencode(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *erq, char *keybuf)
@@ -166,14 +140,14 @@ static int prism2_ioctl_siwencode(struct net_device *dev,
if (erq->flags & IW_ENCODE_DISABLED) {
if (*crypt)
- prism2_crypt_delayed_deinit(local, crypt);
+ lib80211_crypt_delayed_deinit(&local->crypt_info, crypt);
goto done;
}
if (*crypt != NULL && (*crypt)->ops != NULL &&
strcmp((*crypt)->ops->name, "WEP") != 0) {
/* changing to use WEP; deinit previously used algorithm */
- prism2_crypt_delayed_deinit(local, crypt);
+ lib80211_crypt_delayed_deinit(&local->crypt_info, crypt);
}
if (*crypt == NULL) {
@@ -189,7 +163,7 @@ static int prism2_ioctl_siwencode(struct net_device *dev,
request_module("lib80211_crypt_wep");
new_crypt->ops = lib80211_get_crypto_ops("WEP");
}
- if (new_crypt->ops)
+ if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
new_crypt->priv = new_crypt->ops->init(i);
if (!new_crypt->ops || !new_crypt->priv) {
kfree(new_crypt);
@@ -3269,7 +3243,7 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
if ((erq->flags & IW_ENCODE_DISABLED) ||
ext->alg == IW_ENCODE_ALG_NONE) {
if (*crypt)
- prism2_crypt_delayed_deinit(local, crypt);
+ lib80211_crypt_delayed_deinit(&local->crypt_info, crypt);
goto done;
}
@@ -3317,7 +3291,7 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
if (*crypt == NULL || (*crypt)->ops != ops) {
struct lib80211_crypt_data *new_crypt;
- prism2_crypt_delayed_deinit(local, crypt);
+ lib80211_crypt_delayed_deinit(&local->crypt_info, crypt);
new_crypt = kzalloc(sizeof(struct lib80211_crypt_data),
GFP_KERNEL);
@@ -3326,7 +3300,8 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
goto done;
}
new_crypt->ops = ops;
- new_crypt->priv = new_crypt->ops->init(i);
+ if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
+ new_crypt->priv = new_crypt->ops->init(i);
if (new_crypt->priv == NULL) {
kfree(new_crypt);
ret = -EINVAL;
@@ -3503,7 +3478,7 @@ static int prism2_ioctl_set_encryption(local_info_t *local,
if (strcmp(param->u.crypt.alg, "none") == 0) {
if (crypt)
- prism2_crypt_delayed_deinit(local, crypt);
+ lib80211_crypt_delayed_deinit(&local->crypt_info, crypt);
goto done;
}
@@ -3533,7 +3508,7 @@ static int prism2_ioctl_set_encryption(local_info_t *local,
if (*crypt == NULL || (*crypt)->ops != ops) {
struct lib80211_crypt_data *new_crypt;
- prism2_crypt_delayed_deinit(local, crypt);
+ lib80211_crypt_delayed_deinit(&local->crypt_info, crypt);
new_crypt = kzalloc(sizeof(struct lib80211_crypt_data),
GFP_KERNEL);