Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=19bb3506e27096eea5f7b71b89621ad1203ed318
Commit:     19bb3506e27096eea5f7b71b89621ad1203ed318
Parent:     0304ff8a2d5f57defb011c7f261b4c1b3eff96d1
Author:     Evgeny Kravtsunov <[EMAIL PROTECTED]>
AuthorDate: Tue Apr 17 12:31:24 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Tue Apr 17 14:16:00 2007 -0700

    [BRIDGE]: Unaligned access when comparing ethernet addresses
    
    compare_ether_addr() implicitly requires that the addresses
    passed are 2-bytes aligned in memory.
    
    This is not true for br_stp_change_bridge_id() and
    br_stp_recalculate_bridge_id() in which one of the addresses
    is unsigned char *, and thus may not be 2-bytes aligned.
    
    Signed-off-by: Evgeny Kravtsunov <[EMAIL PROTECTED]>
    Signed-off-by: Kirill Korotaev <[EMAIL PROTECTED]>
    Signed-off-by: Pavel Emelianov <[EMAIL PROTECTED]>
---
 net/bridge/br_stp_if.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 58d13f2..a285897 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -126,7 +126,9 @@ void br_stp_disable_port(struct net_bridge_port *p)
 /* called under bridge lock */
 void br_stp_change_bridge_id(struct net_bridge *br, const unsigned char *addr)
 {
-       unsigned char oldaddr[6];
+       /* should be aligned on 2 bytes for compare_ether_addr() */
+       unsigned short oldaddr_aligned[ETH_ALEN >> 1];
+       unsigned char *oldaddr = (unsigned char *)oldaddr_aligned;
        struct net_bridge_port *p;
        int wasroot;
 
@@ -151,11 +153,14 @@ void br_stp_change_bridge_id(struct net_bridge *br, const 
unsigned char *addr)
                br_become_root_bridge(br);
 }
 
-static const unsigned char br_mac_zero[6];
+/* should be aligned on 2 bytes for compare_ether_addr() */
+static const unsigned short br_mac_zero_aligned[ETH_ALEN >> 1];
 
 /* called under bridge lock */
 void br_stp_recalculate_bridge_id(struct net_bridge *br)
 {
+       const unsigned char *br_mac_zero =
+                       (const unsigned char *)br_mac_zero_aligned;
        const unsigned char *addr = br_mac_zero;
        struct net_bridge_port *p;
 
-
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