All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org
Subject: Re: [PATCH 3/3] mac80211: batch key free synchronize_net()
Date: Thu, 07 Mar 2013 11:29:49 +0100	[thread overview]
Message-ID: <1362652189.8694.29.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <1362652067-14903-3-git-send-email-johannes@sipsolutions.net> (sfid-20130307_112756_625579_02BAA0CA)

On Thu, 2013-03-07 at 11:27 +0100, Johannes Berg wrote:

>  void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata)
>  {
>  	struct ieee80211_key *key, *tmp;
> +	LIST_HEAD(keys);
>  
>  	cancel_delayed_work_sync(&sdata->dec_tailroom_needed_wk);
>  
> @@ -571,17 +578,61 @@ void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata)
>  
>  	ieee80211_debugfs_key_remove_mgmt_default(sdata);
>  
> -	list_for_each_entry_safe(key, tmp, &sdata->key_list, list)
> -		ieee80211_key_free(key, false);
> +	list_for_each_entry_safe(key, tmp, &sdata->key_list, list) {
> +		ieee80211_key_replace(key->sdata, key->sta,
> +				key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE,
> +				key, NULL);
> +		list_add_tail(&key->list, &keys);
> +	}
>  
>  	ieee80211_debugfs_key_update_default(sdata);
>  
> +	synchronize_net();
> +	list_for_each_entry_safe(key, tmp, &keys, list)
> +		__ieee80211_key_destroy(key, false);

Since it's likely that there are no keys, I'll change this:

 	ieee80211_debugfs_key_update_default(sdata);
 
-	synchronize_net();
-	list_for_each_entry_safe(key, tmp, &keys, list)
-		__ieee80211_key_destroy(key, false);
+	if (!list_empty(&keys)) {
+		synchronize_net();
+		list_for_each_entry_safe(key, tmp, &keys, list)
+			__ieee80211_key_destroy(key, false);
+	}
 
 	WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt ||
 		     sdata->crypto_tx_tailroom_pending_dec);


johannes


  reply	other threads:[~2013-03-07 10:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-07 10:27 [PATCH 1/3] mac80211: clean up key freeing a bit Johannes Berg
2013-03-07 10:27 ` [PATCH 2/3] mac80211: remove underscores from some key functions Johannes Berg
2013-03-07 10:27 ` [PATCH 3/3] mac80211: batch key free synchronize_net() Johannes Berg
2013-03-07 10:29   ` Johannes Berg [this message]
2013-03-11  7:41 ` [PATCH 1/3] mac80211: clean up key freeing a bit Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1362652189.8694.29.camel@jlt4.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.