All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Daniel Drake <dsd@gentoo.org>,
	linux-wireless@vger.kernel.org,
	John Linville <linville@tuxdriver.com>
Subject: Re: Strange mac80211 oops
Date: Wed, 2 Jan 2008 16:21:26 +0100	[thread overview]
Message-ID: <200801021621.26401.mb@bu3sch.de> (raw)
In-Reply-To: <1199263731.4172.66.camel@johannes.berg>

On Wednesday 02 January 2008 09:48:51 Johannes Berg wrote:
> 
> On Sat, 2007-12-29 at 17:24 +0100, Michael Buesch wrote:
> > This patch fixes RX packet alignment issues in the zd1211rw driver.
> > This is based on a patch by Johannes Berg.
> > 
> > Signed-off-by: Michael Buesch <mb@bu3sch.de>
> 
> Looks good to me, I guess you tested it.

Yes, works fine.

> Acked-by: Johannes Berg <johannes@sipsolutions.net>
> 
> > Index: wireless-2.6/drivers/net/wireless/zd1211rw/zd_mac.c
> > ===================================================================
> > --- wireless-2.6.orig/drivers/net/wireless/zd1211rw/zd_mac.c	2007-12-29 17:14:41.000000000 +0100
> > +++ wireless-2.6/drivers/net/wireless/zd1211rw/zd_mac.c	2007-12-29 17:15:00.000000000 +0100
> > @@ -623,6 +623,8 @@ int zd_mac_rx(struct ieee80211_hw *hw, c
> >  	const struct rx_status *status;
> >  	struct sk_buff *skb;
> >  	int bad_frame = 0;
> > +	u16 fc;
> > +	bool is_qos, is_4addr, need_padding;
> >  
> >  	if (length < ZD_PLCP_HEADER_SIZE + 10 /* IEEE80211_1ADDR_LEN */ +
> >  	             FCS_LEN + sizeof(struct rx_status))
> > @@ -674,9 +676,22 @@ int zd_mac_rx(struct ieee80211_hw *hw, c
> >  			&& !mac->pass_ctrl)
> >  		return 0;
> >  
> > -	skb = dev_alloc_skb(length);
> > +	fc = le16_to_cpu(*((__le16 *) buffer));
> > +
> > +	is_qos = ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
> > +		 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_QOS_DATA);
> > +	is_4addr = (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
> > +		   (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS);
> > +	need_padding = is_qos ^ is_4addr;
> > +
> > +	skb = dev_alloc_skb(length + (need_padding ? 2 : 0));
> >  	if (skb == NULL)
> >  		return -ENOMEM;
> > +	if (need_padding) {
> > +		/* Make sure the the payload data is 4 byte aligned. */
> > +		skb_reserve(skb, 2);
> > +	}
> > +
> >  	memcpy(skb_put(skb, length), buffer, length);
> >  
> >  	ieee80211_rx_irqsafe(hw, skb, &stats);
> > 
> 



-- 
Greetings Michael.

      reply	other threads:[~2008-01-02 15:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-24 21:37 Strange mac80211 oops Michael Buesch
2007-12-24 21:45 ` Johannes Berg
2007-12-24 21:57   ` Johannes Berg
2007-12-24 22:28     ` Michael Buesch
2007-12-29 13:32       ` Daniel Drake
2007-12-29 13:48         ` Johannes Berg
2007-12-29 16:24           ` Michael Buesch
2008-01-02  8:48             ` Johannes Berg
2008-01-02 15:21               ` 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=200801021621.26401.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=dsd@gentoo.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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 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.