Skip to content

Commit

Permalink
net: hsr: align sup_multicast_addr in struct hsr_priv to u16 boundary
Browse files Browse the repository at this point in the history
sup_multicast_addr is passed to ether_addr_equal for address comparison
which casts the address inputs to u16 leading to an unaligned access.
Aligning the sup_multicast_addr to u16 boundary fixes the issue.

Signed-off-by: Andreas Oetken <andreas.oetken@siemens.com>
Link: https://lore.kernel.org/r/20210202090304.2740471-1-ennoerlangen@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Andreas Oetken authored and Jakub Kicinski committed Feb 2, 2021
1 parent 5a4cb54 commit 6c9f18f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/hsr/hsr_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@ struct hsr_priv {
u8 net_id; /* for PRP, it occupies most significant 3 bits
* of lan_id
*/
unsigned char sup_multicast_addr[ETH_ALEN];
unsigned char sup_multicast_addr[ETH_ALEN] __aligned(sizeof(u16));
/* Align to u16 boundary to avoid unaligned access
* in ether_addr_equal
*/
#ifdef CONFIG_DEBUG_FS
struct dentry *node_tbl_root;
#endif
Expand Down

0 comments on commit 6c9f18f

Please sign in to comment.