Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[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 <emkravts@openvz.org>
Signed-off-by: Kirill Korotaev <dev@openvz.org>
Signed-off-by: Pavel Emelianov <xemul@openvz.org>

authored by

Evgeny Kravtsunov and committed by
David S. Miller
19bb3506 0304ff8a

+7 -2
+7 -2
net/bridge/br_stp_if.c
··· 126 126 /* called under bridge lock */ 127 127 void br_stp_change_bridge_id(struct net_bridge *br, const unsigned char *addr) 128 128 { 129 - unsigned char oldaddr[6]; 129 + /* should be aligned on 2 bytes for compare_ether_addr() */ 130 + unsigned short oldaddr_aligned[ETH_ALEN >> 1]; 131 + unsigned char *oldaddr = (unsigned char *)oldaddr_aligned; 130 132 struct net_bridge_port *p; 131 133 int wasroot; 132 134 ··· 153 151 br_become_root_bridge(br); 154 152 } 155 153 156 - static const unsigned char br_mac_zero[6]; 154 + /* should be aligned on 2 bytes for compare_ether_addr() */ 155 + static const unsigned short br_mac_zero_aligned[ETH_ALEN >> 1]; 157 156 158 157 /* called under bridge lock */ 159 158 void br_stp_recalculate_bridge_id(struct net_bridge *br) 160 159 { 160 + const unsigned char *br_mac_zero = 161 + (const unsigned char *)br_mac_zero_aligned; 161 162 const unsigned char *addr = br_mac_zero; 162 163 struct net_bridge_port *p; 163 164