linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivo van Doorn <ivdoorn@gmail.com>
To: chris2553@googlemail.com
Cc: "Kalle Valo" <kalle.valo@nokia.com>,
	"Johannes Berg" <johannes@sipsolutions.net>,
	linux-wireless@vger.kernel.org
Subject: Re: Warning emited by 2.6.24-rc6-git5
Date: Wed, 2 Jan 2008 20:02:29 +0100	[thread overview]
Message-ID: <200801022002.29262.IvDoorn@gmail.com> (raw)
In-Reply-To: <200801020632.31361.chris2553@googlemail.com>

On Wednesday 02 January 2008, Chris Clayton wrote:
> On Monday 31 December 2007, Ivo Van Doorn wrote:
> > On Dec 31, 2007 8:27 AM, Kalle Valo <kalle.valo@nokia.com> wrote:
> > > Ivo van Doorn <ivdoorn@gmail.com> writes:
> > > > +             /*
> > > > +              * Move entire frame 2 bytes to the front.
> > > > +              */
> > > > +             skb_push(skb, 2);
> > > > +             memmove(skb->data, skb->data + 2, skb->len - 2);
> > >
> > > No skb_trim()? Shoudn't there be skb_trim(skb, 2) after memmove()?
> >
> > Good point, I completely forgot about that. :S
> > Thanks. :)
> >
> > Ivo
> 
> Ah, does the patch I have applied and am running need enhancement, please?

---

diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index ff399f8..3c10a68 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -386,6 +386,7 @@ void rt2x00lib_rxdone(struct data_entry *entry, struct sk_buff *skb,
 	struct ieee80211_rx_status *rx_status = &rt2x00dev->rx_status;
 	struct ieee80211_hw_mode *mode;
 	struct ieee80211_rate *rate;
+	unsigned int header_size;
 	unsigned int i;
 	int val = 0;
 
@@ -412,6 +413,27 @@ void rt2x00lib_rxdone(struct data_entry *entry, struct sk_buff *skb,
 		}
 	}
 
+	/*
+	 * Properly align the ieee80211 frame and make sure the
+	 * data behind the ieee80211 header is on a 4 byte boundrary.
+	 */
+	header_size = ieee80211_get_hdrlen_from_skb(skb);
+	if (!header_size) {
+		/*
+		 * Frame is too short to contain a valid header,
+		 * drop the entire frame since it is useless.
+		 */
+		kfree_skb(skb);
+		return;
+	} else if (header_size % 4 == 0) {
+		/*
+		 * Move entire frame 2 bytes to the front.
+		 */
+		skb_push(skb, 2);
+		memmove(skb->data, skb->data + 2, skb->len - 2);
+		skb_trim(skb, skb->len - 2);
+	}
+
 	rt2x00_update_link_rssi(&rt2x00dev->link, desc->rssi);
 	rt2x00dev->link.rx_success++;
 	rx_status->rate = val;

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

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-29  9:42 Warning emited by 2.6.24-rc6-git5 Chris Clayton
2007-12-29  9:54 ` Johannes Berg
2007-12-29 10:21   ` Ivo van Doorn
2007-12-29 10:26     ` Johannes Berg
2007-12-29 10:36     ` Johannes Berg
2007-12-29 11:47       ` Ivo van Doorn
2007-12-29 11:59         ` Johannes Berg
2007-12-29 12:01           ` Johannes Berg
2007-12-29 14:29           ` Ivo van Doorn
2007-12-29 14:40             ` Johannes Berg
2007-12-29 15:14               ` Ivo van Doorn
2007-12-30 11:49                 ` Chris Clayton
2007-12-30 12:11                   ` Ivo van Doorn
2007-12-30 19:26                     ` Chris Clayton
2007-12-30 22:01                       ` Ivo van Doorn
2007-12-31  7:27                     ` Kalle Valo
2007-12-31  7:56                       ` Ivo Van Doorn
2008-01-02  6:32                         ` Chris Clayton
2008-01-02 19:02                           ` Ivo van Doorn [this message]
2008-01-04 17:09                             ` Chris Clayton
2008-01-06  7:49                               ` Andrew Price
2008-01-08  6:03                               ` Chris Clayton
2008-01-02  8:11                 ` Johannes Berg
2008-01-02 19:12                   ` Ivo van Doorn
2008-01-08 15:44                     ` Tomas Winkler
2008-01-08 17:09                       ` Johannes Berg
2008-01-08 17:22                         ` Johannes Berg
2008-01-08 19:43                           ` Tomas Winkler
2008-01-08 20:02                             ` Michael Buesch
2008-01-08 23:18                               ` Tomas Winkler
2008-01-09 12:49                             ` Johannes Berg

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=200801022002.29262.IvDoorn@gmail.com \
    --to=ivdoorn@gmail.com \
    --cc=chris2553@googlemail.com \
    --cc=johannes@sipsolutions.net \
    --cc=kalle.valo@nokia.com \
    --cc=linux-wireless@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 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).