Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9313794371ad39e6bf88e1fbef8dfb3bd1ae3fe7
Commit:     9313794371ad39e6bf88e1fbef8dfb3bd1ae3fe7
Parent:     74cda169fe65ca1dedad6d4a905b13c6ccd87351
Author:     Ulrich Kunitz <[EMAIL PROTECTED]>
AuthorDate: Sat Dec 1 11:26:05 2007 +0100
Committer:  John W. Linville <[EMAIL PROTECTED]>
CommitDate: Mon Dec 17 17:01:39 2007 -0500

    zd1211rw: Fix alignment problems
    
    Shaddy Baddah found an alignment problem with zd1211rw driver at
    2007-11-19. This patch fixes it, it is based on the patch proposed by
    Herbert Xu. The alignment 4 has been the agreed value on the
    linux-wireless mailing list.
    
    Notify that the problem does only affect the old zd1211rw softmac
    driver and not the zd1211rw-mac80211 driver. Daniel Drake has
    already provided a patch for the replacement of the softmac
    driver, which this patch will break.
    
    Signed-off-by: Ulrich Kunitz <[EMAIL PROTECTED]>
    Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
---
 drivers/net/wireless/zd1211rw/zd_mac.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c 
b/drivers/net/wireless/zd1211rw/zd_mac.c
index a903645..5298a8b 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -1130,6 +1130,8 @@ static void zd_mac_rx(struct zd_mac *mac, struct sk_buff 
*skb)
        __skb_trim(skb, skb->len -
                        (IEEE80211_FCS_LEN + sizeof(struct rx_status)));
 
+       ZD_ASSERT(IS_ALIGNED((unsigned long)skb->data, 4));
+
        update_qual_rssi(mac, skb->data, skb->len, stats.signal,
                         status->signal_strength);
 
@@ -1166,15 +1168,19 @@ static void do_rx(unsigned long mac_ptr)
 int zd_mac_rx_irq(struct zd_mac *mac, const u8 *buffer, unsigned int length)
 {
        struct sk_buff *skb;
+       unsigned int reserved =
+               ALIGN(max_t(unsigned int,
+                           sizeof(struct zd_rt_hdr), ZD_PLCP_HEADER_SIZE), 4) -
+               ZD_PLCP_HEADER_SIZE;
 
-       skb = dev_alloc_skb(sizeof(struct zd_rt_hdr) + length);
+       skb = dev_alloc_skb(reserved + length);
        if (!skb) {
                struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
                dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n");
                ieee->stats.rx_dropped++;
                return -ENOMEM;
        }
-       skb_reserve(skb, sizeof(struct zd_rt_hdr));
+       skb_reserve(skb, reserved);
        memcpy(__skb_put(skb, length), buffer, length);
        skb_queue_tail(&mac->rx_queue, skb);
        tasklet_schedule(&mac->rx_tasklet);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to