Search Linux Wireless

Re: [PATCH] wireless: convert reg_regdb_search_lock to mutex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> Signed-off-by: John W. Linville <linville@xxxxxxxxxxxxx>
> ---
> 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@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux