linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* mac80211 : fix unaligned rx skb
@ 2009-06-04 20:16 matthieu castet
  2009-06-04 20:53 ` Luis R. Rodriguez
  0 siblings, 1 reply; 8+ messages in thread
From: matthieu castet @ 2009-06-04 20:16 UTC (permalink / raw)
  To: linux-wireless

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: mac80211_alignement.diff --]
[-- Type: text/x-diff, Size: 764 bytes --]

mac80211 is checking is the skb is aligned on 32 bit boundary.
But it is checking against ethernet header, whereas Linux expect IP
header aligned.
And ethernet ether size is 6*2+2=14, so aligning ethernet header make IP header unaligned.

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 9776f73..0845fb3 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1397,7 +1397,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
 		 * mac80211. That also explains the __skb_push()
 		 * below.
 		 */
-		align = (unsigned long)skb->data & 3;
+		align = ((unsigned long)(skb->data + sizeof(struct ethhdr))) & 3;
 		if (align) {
 			if (WARN_ON(skb_headroom(skb) < 3)) {
 				dev_kfree_skb(skb);

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: mac80211 : fix unaligned rx skb
  2009-06-04 20:16 mac80211 : fix unaligned rx skb matthieu castet
@ 2009-06-04 20:53 ` Luis R. Rodriguez
  2009-06-04 21:16   ` Georgy Berdyshev
  0 siblings, 1 reply; 8+ messages in thread
From: Luis R. Rodriguez @ 2009-06-04 20:53 UTC (permalink / raw)
  To: matthieu castet; +Cc: linux-wireless

On Thu, Jun 4, 2009 at 1:16 PM, matthieu castet <castet.matthieu@free.fr> wrote:
>

This is all I see, can you resend with patch inline?

  Luis

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: mac80211 : fix unaligned rx skb
  2009-06-04 20:53 ` Luis R. Rodriguez
@ 2009-06-04 21:16   ` Georgy Berdyshev
  2009-06-04 21:40     ` Michael Buesch
  0 siblings, 1 reply; 8+ messages in thread
From: Georgy Berdyshev @ 2009-06-04 21:16 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: matthieu castet, linux-wireless

Hi,

that's the inline version:
-------
mac80211 is checking is the skb is aligned on 32 bit boundary.
But it is checking against ethernet header, whereas Linux expect IP
header aligned.
And ethernet ether size is 6*2+2=14, so aligning ethernet header make
IP header unaligned.

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 9776f73..0845fb3 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1397,7 +1397,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
 		 * mac80211. That also explains the __skb_push()
 		 * below.
 		 */
-		align = (unsigned long)skb->data & 3;
+		align = ((unsigned long)(skb->data + sizeof(struct ethhdr))) & 3;
 		if (align) {
 			if (WARN_ON(skb_headroom(skb) < 3)) {
 				dev_kfree_skb(skb);
------------

On Thu, Jun 4, 2009 at 5:53 PM, Luis R. Rodriguez <mcgrof@gmail.com> wrote:
> On Thu, Jun 4, 2009 at 1:16 PM, matthieu castet <castet.matthieu@free.fr> wrote:
>>
>
> This is all I see, can you resend with patch inline?
>
>  Luis
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Georgy Berdyshev

GPG key: 830F68C5
Fingerprint: 0379 ED5A BEE5 65A8 7BD5  31E7 F5B4 1EC7 830F 68C5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: mac80211 : fix unaligned rx skb
  2009-06-04 21:16   ` Georgy Berdyshev
@ 2009-06-04 21:40     ` Michael Buesch
  2009-06-05  5:57       ` matthieu castet
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Buesch @ 2009-06-04 21:40 UTC (permalink / raw)
  To: Georgy Berdyshev; +Cc: Luis R. Rodriguez, matthieu castet, linux-wireless

On Thursday 04 June 2009 23:16:13 Georgy Berdyshev wrote:
> Hi,
> 
> that's the inline version:
> -------
> mac80211 is checking is the skb is aligned on 32 bit boundary.
> But it is checking against ethernet header, whereas Linux expect IP
> header aligned.
> And ethernet ether size is 6*2+2=14, so aligning ethernet header make
> IP header unaligned.
> 
> Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
> diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
> index 9776f73..0845fb3 100644
> --- a/net/mac80211/rx.c
> +++ b/net/mac80211/rx.c
> @@ -1397,7 +1397,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
>  		 * mac80211. That also explains the __skb_push()
>  		 * below.
>  		 */
> -		align = (unsigned long)skb->data & 3;
> +		align = ((unsigned long)(skb->data + sizeof(struct ethhdr))) & 3;
>  		if (align) {
>  			if (WARN_ON(skb_headroom(skb) < 3)) {
>  				dev_kfree_skb(skb);

Uhm, can you give a more verbose explanation? Without that I'd say this patch is plain wrong.
What the hell does struct ethhdr have to do with wireless?
This is not ethernet. It's 802.11. There is no such thing as an ethernet header in a 802.11 packet.

-- 
Greetings, Michael.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: mac80211 : fix unaligned rx skb
  2009-06-04 21:40     ` Michael Buesch
@ 2009-06-05  5:57       ` matthieu castet
  2009-06-07  9:24         ` matthieu castet
  0 siblings, 1 reply; 8+ messages in thread
From: matthieu castet @ 2009-06-05  5:57 UTC (permalink / raw)
  To: Michael Buesch; +Cc: Georgy Berdyshev, Luis R. Rodriguez, linux-wireless

Michael Buesch wrote:
> On Thursday 04 June 2009 23:16:13 Georgy Berdyshev wrote:
>> Hi,
>>
>> that's the inline version:
>> -------
>> mac80211 is checking is the skb is aligned on 32 bit boundary.
>> But it is checking against ethernet header, whereas Linux expect IP
>> header aligned.
>> And ethernet ether size is 6*2+2=14, so aligning ethernet header make
>> IP header unaligned.
>>
>> Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
>> diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
>> index 9776f73..0845fb3 100644
>> --- a/net/mac80211/rx.c
>> +++ b/net/mac80211/rx.c
>> @@ -1397,7 +1397,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
>>  		 * mac80211. That also explains the __skb_push()
>>  		 * below.
>>  		 */
>> -		align = (unsigned long)skb->data & 3;
>> +		align = ((unsigned long)(skb->data + sizeof(struct ethhdr))) & 3;
>>  		if (align) {
>>  			if (WARN_ON(skb_headroom(skb) < 3)) {
>>  				dev_kfree_skb(skb);
> 
> Uhm, can you give a more verbose explanation? Without that I'd say this patch is plain wrong.
> What the hell does struct ethhdr have to do with wireless?
 > This is not ethernet. It's 802.11. There is no such thing as an
 > ethernet header in a 802.11 packet.
 >
Where are in ieee80211_deliver_skb that is called after 
ieee80211_data_to_8023. So it is not 802.11.

Matthieu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: mac80211 : fix unaligned rx skb
  2009-06-05  5:57       ` matthieu castet
@ 2009-06-07  9:24         ` matthieu castet
  2009-06-07  9:26           ` Michael Buesch
  0 siblings, 1 reply; 8+ messages in thread
From: matthieu castet @ 2009-06-07  9:24 UTC (permalink / raw)
  To: Michael Buesch; +Cc: Georgy Berdyshev, Luis R. Rodriguez, linux-wireless

matthieu castet wrote:
> Michael Buesch wrote:
>> On Thursday 04 June 2009 23:16:13 Georgy Berdyshev wrote:
>>> Hi,
>>>
>>> that's the inline version:
>>> -------
>>> mac80211 is checking is the skb is aligned on 32 bit boundary.
>>> But it is checking against ethernet header, whereas Linux expect IP
>>> header aligned.
>>> And ethernet ether size is 6*2+2=14, so aligning ethernet header make
>>> IP header unaligned.
>>>
>>> Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
>>> diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
>>> index 9776f73..0845fb3 100644
>>> --- a/net/mac80211/rx.c
>>> +++ b/net/mac80211/rx.c
>>> @@ -1397,7 +1397,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data 
>>> *rx)
>>>           * mac80211. That also explains the __skb_push()
>>>           * below.
>>>           */
>>> -        align = (unsigned long)skb->data & 3;
>>> +        align = ((unsigned long)(skb->data + sizeof(struct ethhdr))) 
>>> & 3;
>>>          if (align) {
>>>              if (WARN_ON(skb_headroom(skb) < 3)) {
>>>                  dev_kfree_skb(skb);
>>
>> Uhm, can you give a more verbose explanation? Without that I'd say 
>> this patch is plain wrong.
>> What the hell does struct ethhdr have to do with wireless?
>  > This is not ethernet. It's 802.11. There is no such thing as an
>  > ethernet header in a 802.11 packet.
>  >
> Where are in ieee80211_deliver_skb that is called after 
> ieee80211_data_to_8023. So it is not 802.11.
> 
Do you want more explanation ?

Matthieu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: mac80211 : fix unaligned rx skb
  2009-06-07  9:24         ` matthieu castet
@ 2009-06-07  9:26           ` Michael Buesch
  2009-06-07 15:18             ` John W. Linville
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Buesch @ 2009-06-07  9:26 UTC (permalink / raw)
  To: matthieu castet; +Cc: Georgy Berdyshev, Luis R. Rodriguez, linux-wireless

On Sunday 07 June 2009 11:24:48 matthieu castet wrote:
> matthieu castet wrote:
> > Michael Buesch wrote:
> >> On Thursday 04 June 2009 23:16:13 Georgy Berdyshev wrote:
> >>> Hi,
> >>>
> >>> that's the inline version:
> >>> -------
> >>> mac80211 is checking is the skb is aligned on 32 bit boundary.
> >>> But it is checking against ethernet header, whereas Linux expect IP
> >>> header aligned.
> >>> And ethernet ether size is 6*2+2=14, so aligning ethernet header make
> >>> IP header unaligned.
> >>>
> >>> Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
> >>> diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
> >>> index 9776f73..0845fb3 100644
> >>> --- a/net/mac80211/rx.c
> >>> +++ b/net/mac80211/rx.c
> >>> @@ -1397,7 +1397,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data 
> >>> *rx)
> >>>           * mac80211. That also explains the __skb_push()
> >>>           * below.
> >>>           */
> >>> -        align = (unsigned long)skb->data & 3;
> >>> +        align = ((unsigned long)(skb->data + sizeof(struct ethhdr))) 
> >>> & 3;
> >>>          if (align) {
> >>>              if (WARN_ON(skb_headroom(skb) < 3)) {
> >>>                  dev_kfree_skb(skb);
> >>
> >> Uhm, can you give a more verbose explanation? Without that I'd say 
> >> this patch is plain wrong.
> >> What the hell does struct ethhdr have to do with wireless?
> >  > This is not ethernet. It's 802.11. There is no such thing as an
> >  > ethernet header in a 802.11 packet.
> >  >
> > Where are in ieee80211_deliver_skb that is called after 
> > ieee80211_data_to_8023. So it is not 802.11.
> > 
> Do you want more explanation ?

No reply always means "ok" on this list ;)

-- 
Greetings, Michael.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: mac80211 : fix unaligned rx skb
  2009-06-07  9:26           ` Michael Buesch
@ 2009-06-07 15:18             ` John W. Linville
  0 siblings, 0 replies; 8+ messages in thread
From: John W. Linville @ 2009-06-07 15:18 UTC (permalink / raw)
  To: Michael Buesch
  Cc: matthieu castet, Georgy Berdyshev, Luis R. Rodriguez,
	linux-wireless, johannes

On Sun, Jun 07, 2009 at 11:26:22AM +0200, Michael Buesch wrote:
> On Sunday 07 June 2009 11:24:48 matthieu castet wrote:
> > matthieu castet wrote:

> > > Where are in ieee80211_deliver_skb that is called after 
> > > ieee80211_data_to_8023. So it is not 802.11.
> > > 
> > Do you want more explanation ?
> 
> No reply always means "ok" on this list ;)

Probably true...however, I was hoping to see an ACK from Johannes...

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-06-07 15:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-04 20:16 mac80211 : fix unaligned rx skb matthieu castet
2009-06-04 20:53 ` Luis R. Rodriguez
2009-06-04 21:16   ` Georgy Berdyshev
2009-06-04 21:40     ` Michael Buesch
2009-06-05  5:57       ` matthieu castet
2009-06-07  9:24         ` matthieu castet
2009-06-07  9:26           ` Michael Buesch
2009-06-07 15:18             ` John W. Linville

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).