rt2x00: Fix trimming of L2 padded frames.
authorGertjan van Wingerde <gwingerde@gmail.com>
Fri, 4 Dec 2009 22:47:07 +0000 (23:47 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 21 Dec 2009 23:56:41 +0000 (18:56 -0500)
Ensure that frames without payload are properly trimmed in
rt2x00queue_insert_l2pad.

This should fix the bug reported by Benoit Papillault in:
http://marc.info/?l=linux-wireless&m=125974773006734&w=2

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2x00queue.c

index 7452fa850a0fde48c7d95fcaaca3d81cfdb74ef4..3d8fb684b4ebb915381889a6e02378f7edcc9d24 100644 (file)
@@ -180,7 +180,7 @@ void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length)
        unsigned int payload_length = skb->len - header_length;
        unsigned int header_align = ALIGN_SIZE(skb, 0);
        unsigned int payload_align = ALIGN_SIZE(skb, header_length);
-       unsigned int l2pad = L2PAD_SIZE(header_length);
+       unsigned int l2pad = payload_length ? L2PAD_SIZE(header_length) : 0;
 
        /*
         * Adjust the header alignment if the payload needs to be moved more