All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: Daniel Drake <dsd@gentoo.org>
Cc: linville@tuxdriver.com, netdev@vger.kernel.org,
	johannes@sipsolutions.net
Subject: Re: [PATCH] softmac: do shared key auth in workqueue
Date: Wed, 12 Jul 2006 00:49:49 +0200	[thread overview]
Message-ID: <200607120049.49601.mb@bu3sch.de> (raw)
In-Reply-To: <20060711221634.7B3A58B2E80@zog.reactivated.net>

On Wednesday 12 July 2006 00:16, you wrote:
> Johann Uhrmann reported a bcm43xx crash and Michael Buesch tracked it down
> to a problem with the new shared key auth code (recursive calls into the driver)
> 
> This patch (effectively Michael's patch with a couple of small modifications)
> solves the problem by sending the authentication challenge response frame
> from a workqueue entry.
> 
> I also removed a lone \n from the bcm43xx messages relating to authentication
> mode - this small change was previously discussed but not patched in.
> 
> Signed-off-by: Daniel Drake <dsd@gentoo.org>
> Acked-by: Johannes Berg <johannes@sipsolutions.net>

Signed-off-by: Michael Buesch <mb@bu3sch.de>

> 
> Index: linux/net/ieee80211/softmac/ieee80211softmac_auth.c
> ===================================================================
> --- linux.orig/net/ieee80211/softmac/ieee80211softmac_auth.c
> +++ linux/net/ieee80211/softmac/ieee80211softmac_auth.c
> @@ -116,6 +116,16 @@ ieee80211softmac_auth_queue(void *data)
>  	kfree(auth);
>  }
>  
> +/* Sends a response to an auth challenge (for shared key auth). */
> +static void
> +ieee80211softmac_auth_challenge_response(void *_aq)
> +{
> +	struct ieee80211softmac_auth_queue_item *aq = _aq;
> +
> +	/* Send our response */
> +	ieee80211softmac_send_mgt_frame(aq->mac, aq->net, IEEE80211_STYPE_AUTH, aq->state);
> +}
> +
>  /* Handle the auth response from the AP
>   * This should be registered with ieee80211 as handle_auth 
>   */
> @@ -197,24 +207,30 @@ ieee80211softmac_auth_resp(struct net_de
>  		case IEEE80211SOFTMAC_AUTH_SHARED_CHALLENGE:
>  			/* Check to make sure we have a challenge IE */
>  			data = (u8 *)auth->info_element;
> -			if(*data++ != MFIE_TYPE_CHALLENGE){
> +			if (*data++ != MFIE_TYPE_CHALLENGE) {
>  				printkl(KERN_NOTICE PFX "Shared Key Authentication failed due to a missing challenge.\n");
>  				break;	
>  			}
>  			/* Save the challenge */
>  			spin_lock_irqsave(&mac->lock, flags);
>  			net->challenge_len = *data++; 	
> -			if(net->challenge_len > WLAN_AUTH_CHALLENGE_LEN)
> +			if (net->challenge_len > WLAN_AUTH_CHALLENGE_LEN)
>  				net->challenge_len = WLAN_AUTH_CHALLENGE_LEN;
> -			if(net->challenge != NULL)
> +			if (net->challenge != NULL)
>  				kfree(net->challenge);
>  			net->challenge = kmalloc(net->challenge_len, GFP_ATOMIC);
>  			memcpy(net->challenge, data, net->challenge_len);
>  			aq->state = IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE; 
> -			spin_unlock_irqrestore(&mac->lock, flags);
>  
> -			/* Send our response */
> -			ieee80211softmac_send_mgt_frame(mac, aq->net, IEEE80211_STYPE_AUTH, aq->state);
> +			/* We reuse the work struct from the auth request here.
> +			 * It is safe to do so as each one is per-request, and
> +			 * at this point (dealing with authentication response)
> +			 * we have obviously already sent the initial auth
> +			 * request. */
> +			cancel_delayed_work(&aq->work);
> +			INIT_WORK(&aq->work, &ieee80211softmac_auth_challenge_response, (void *)aq);
> +			schedule_work(&aq->work);
> +			spin_unlock_irqrestore(&mac->lock, flags);
>  			return 0;
>  		case IEEE80211SOFTMAC_AUTH_SHARED_PASS:
>  			kfree(net->challenge);
> Index: linux/drivers/net/wireless/bcm43xx/bcm43xx_main.c
> ===================================================================
> --- linux.orig/drivers/net/wireless/bcm43xx/bcm43xx_main.c
> +++ linux/drivers/net/wireless/bcm43xx/bcm43xx_main.c
> @@ -3701,7 +3701,7 @@ static void bcm43xx_ieee80211_set_securi
>  	}
>  	if (sec->flags & SEC_AUTH_MODE) {
>  		secinfo->auth_mode = sec->auth_mode;
> -		dprintk(", .auth_mode = %d\n", sec->auth_mode);
> +		dprintk(", .auth_mode = %d", sec->auth_mode);
>  	}
>  	dprintk("\n");
>  	if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED &&
> 

-- 
Greetings Michael.

      reply	other threads:[~2006-07-11 22:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-11 22:16 [PATCH] softmac: do shared key auth in workqueue Daniel Drake
2006-07-11 22:49 ` Michael Buesch [this message]

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=200607120049.49601.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=dsd@gentoo.org \
    --cc=johannes@sipsolutions.net \
    --cc=linville@tuxdriver.com \
    --cc=netdev@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.