Search Linux Wireless

Re: [PATCH] mac80211: fix oops in ieee80211_scan_state_set_channel()

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

 



On Sat, 2009-07-25 at 01:18 -0400, Pavel Roskin wrote:
> Move check for the final value of local->scan_channel_idx from
> ieee80211_scan_state_decision() to ieee80211_scan_state_set_channel().
> 
> Stop the state machine in ieee80211_scan_work() by checking
> local->scanning.  Don't return a value from
> ieee80211_scan_state_decision().

Helmut, can you please take a look at this? I'm not entirely sure what's
going on.

johannes

> Signed-off-by: Pavel Roskin <proski@xxxxxxx>
> ---
>  net/mac80211/scan.c |   22 +++++++++++-----------
>  1 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
> index b376775..8b5a4a3 100644
> --- a/net/mac80211/scan.c
> +++ b/net/mac80211/scan.c
> @@ -470,18 +470,12 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
>  	return rc;
>  }
>  
> -static int ieee80211_scan_state_decision(struct ieee80211_local *local,
> -					 unsigned long *next_delay)
> +static void ieee80211_scan_state_decision(struct ieee80211_local *local,
> +					  unsigned long *next_delay)
>  {
>  	bool associated = false;
>  	struct ieee80211_sub_if_data *sdata;
>  
> -	/* if no more bands/channels left, complete scan and advance to the idle state */
> -	if (local->scan_channel_idx >= local->scan_req->n_channels) {
> -		ieee80211_scan_completed(&local->hw, false);
> -		return 1;
> -	}
> -
>  	/* check if at least one STA interface is associated */
>  	mutex_lock(&local->iflist_mtx);
>  	list_for_each_entry(sdata, &local->interfaces, list) {
> @@ -517,7 +511,6 @@ static int ieee80211_scan_state_decision(struct ieee80211_local *local,
>  	}
>  
>  	*next_delay = 0;
> -	return 0;
>  }
>  
>  static void ieee80211_scan_state_leave_oper_channel(struct ieee80211_local *local,
> @@ -587,6 +580,12 @@ static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,
>  	struct ieee80211_channel *chan;
>  	struct ieee80211_sub_if_data *sdata = local->scan_sdata;
>  
> +	/* if no more bands/channels left, complete scan and advance to the idle state */
> +	if (local->scan_channel_idx >= local->scan_req->n_channels) {
> +		ieee80211_scan_completed(&local->hw, false);
> +		return;
> +	}
> +
>  	skip = 0;
>  	chan = local->scan_req->channels[local->scan_channel_idx];
>  
> @@ -695,8 +694,7 @@ void ieee80211_scan_work(struct work_struct *work)
>  	do {
>  		switch (local->next_scan_state) {
>  		case SCAN_DECISION:
> -			if (ieee80211_scan_state_decision(local, &next_delay))
> -				return;
> +			ieee80211_scan_state_decision(local, &next_delay);
>  			break;
>  		case SCAN_SET_CHANNEL:
>  			ieee80211_scan_state_set_channel(local, &next_delay);
> @@ -711,6 +709,8 @@ void ieee80211_scan_work(struct work_struct *work)
>  			ieee80211_scan_state_enter_oper_channel(local, &next_delay);
>  			break;
>  		}
> +		if (!local->scanning)
> +			return;
>  	} while (next_delay == 0);
>  
>  	queue_delayed_work(local->hw.workqueue, &local->scan_work,
> 

Attachment: signature.asc
Description: This is a digitally signed message part


[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