linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Senthil Balasubramanian <senthilkumar@atheros.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	Jiri Slaby <jirislaby@gmail.com>,
	"Luis R. Rodriguez" <mcgrof@gmail.com>
Subject: Re: [PATCH] wireless: convert reg_regdb_search_lock to mutex
Date: Tue, 16 Mar 2010 15:33:38 +0530	[thread overview]
Message-ID: <20100316100337.GA1732@senthil-lnx.users.atheros.com> (raw)
In-Reply-To: <1268768940-5654-1-git-send-email-linville@tuxdriver.com>

On Wed, Mar 17, 2010 at 01:19:00AM +0530, John W. Linville wrote:
> Stanse discovered that kmalloc can be called with GFP_KERNEL while
This commit log is confusing. It Should be "Stanse discovered kmalloc
was called with GFP_KERNEL". Obviously kmalloc with GFP_KERNEL shouldn't
be used while holding a spinlock.
> holding this spinlock.  It can be a mutex instead.
> 
> Reported-by: Jiri Slaby <jirislaby@gmail.com>
> Signed-off-by: John W. Linville <linville@tuxdriver.com>
> ---
> Hmmm...I think I can get rid of the unlock of reg_regdb_search_mutex
> before calling set_regdom now as well?
> 
>  net/wireless/reg.c |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/net/wireless/reg.c b/net/wireless/reg.c
> index ed89c59..5f623ed 100644
> --- a/net/wireless/reg.c
> +++ b/net/wireless/reg.c
> @@ -324,7 +324,7 @@ struct reg_regdb_search_request {
>  };
>  
>  static LIST_HEAD(reg_regdb_search_list);
> -static DEFINE_SPINLOCK(reg_regdb_search_lock);
> +static DEFINE_MUTEX(reg_regdb_search_mutex);
>  
>  static void reg_regdb_search(struct work_struct *work)
>  {
> @@ -332,7 +332,7 @@ static void reg_regdb_search(struct work_struct *work)
>  	const struct ieee80211_regdomain *curdom, *regdom;
>  	int i, r;
>  
> -	spin_lock(&reg_regdb_search_lock);
> +	mutex_lock(&reg_regdb_search_mutex);
>  	while (!list_empty(&reg_regdb_search_list)) {
>  		request = list_first_entry(&reg_regdb_search_list,
>  					   struct reg_regdb_search_request,
> @@ -346,18 +346,18 @@ static void reg_regdb_search(struct work_struct *work)
>  				r = reg_copy_regd(&regdom, curdom);
>  				if (r)
>  					break;
> -				spin_unlock(&reg_regdb_search_lock);
> +				mutex_unlock(&reg_regdb_search_mutex);
>  				mutex_lock(&cfg80211_mutex);
>  				set_regdom(regdom);
>  				mutex_unlock(&cfg80211_mutex);
> -				spin_lock(&reg_regdb_search_lock);
> +				mutex_lock(&reg_regdb_search_mutex);
>  				break;
>  			}
>  		}
>  
>  		kfree(request);
>  	}
> -	spin_unlock(&reg_regdb_search_lock);
> +	mutex_unlock(&reg_regdb_search_mutex);
>  }
>  
>  static DECLARE_WORK(reg_regdb_work, reg_regdb_search);
> -- 
> 1.6.2.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-03-16 22:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-16 13:26 regd: sleeping in atomic Jiri Slaby
2010-03-16 16:18 ` Luis R. Rodriguez
2010-03-16 18:42   ` Jiri Slaby
2010-03-16 20:36     ` Luis R. Rodriguez
2010-03-16 19:49 ` [PATCH] wireless: convert reg_regdb_search_lock to mutex John W. Linville
2010-03-16 10:03   ` Senthil Balasubramanian [this message]
2010-03-17  0:24     ` John W. Linville
2010-03-16 12:24       ` Senthil Balasubramanian
2010-03-17  2:56         ` John W. Linville
2010-03-17  3:24           ` Johannes Berg
2010-03-17  1:26             ` Senthil Balasubramanian
2010-03-17 12:55             ` John W. Linville
2010-03-17 13:01               ` John W. Linville
2010-03-17 19:33   ` [PATCH v2] " John W. Linville
2010-03-18 20:47     ` [PATCH v3] " John W. Linville

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=20100316100337.GA1732@senthil-lnx.users.atheros.com \
    --to=senthilkumar@atheros.com \
    --cc=jirislaby@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mcgrof@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).