net: bridge: enfore alignment for ethernet address
Subsystems (4)
PATCH 1/1 net: bridge: enfore alignment for ethernet address
The eth_addr member is passed to ether_addr functions that require 2-byte alignment, therefore the member must be properly aligned to avoid unaligned accesses.
The problem is in place since the initial merge of multicast to unicast:
commit 6db6f0eae6052b70885562e1733896647ec1d807 bridge: multicast to unicast
--- net/bridge/br_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/br_private.h +1 -1
@@ -217,8 +217,8 @@ struct net_bridge_port_group {struct rcu_head rcu;struct timer_list timer;struct br_ip addr; +unsigned char eth_addr[ETH_ALEN ];/* 2-byte aligned */ unsigned char flags; -unsigned char eth_addr[ETH_ALEN ]; };struct net_bridge_mdb_entry {
Signature · 1 line
2.27.0
Quoted 25 lines · Thomas Martitz
The
eth_addrmember is passed toether_addrfunctions that require 2-byte alignment, therefore the member must be properly aligned to avoid unaligned accesses.The problem is in place since the initial merge of multicast to unicast:
commit6db6f0eae6052b70885562e1733896647ec1d807bridge: multicast to unicastFixes 6db6f0eae605 ("bridge: multicast to unicast")Cc Roopa Prabhu <[email protected]>Cc Nikolay Aleksandrov <[email protected]>Cc David S. Miller <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Felix Fietkau <[email protected]>Signed-off-by Thomas Martitz <[email protected]>--- net/bridge/br_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/bridge/br_private.h +0
-0
net/bridge/br_private.h struct net_bridge_port_group { · line 224
Quoted 9 lines
net/bridge/br_private.h +1
-1@@ -217,8 +217,8 @@ struct net_bridge_port_group {struct rcu_head rcu;struct timer_list timer;struct br_ip addr; +unsigned char eth_addr[ETH_ALEN ];/* 2-byte aligned */ unsigned char flags; -unsigned char eth_addr[ETH_ALEN ]; };struct net_bridge_mdb_entry {
Hi Thomas,
To document it and guarantee that future struct changes won't break it I think it'd be a good idea to add __aligned(2) for that member instead of the comment.
Other than that the patch looks good.
Thanks,
Nik
PATCH v2 1/1 net: bridge: enfore alignment for ethernet address
In reply to Thomas MartitzThe eth_addr member is passed to ether_addr functions that require 2-byte alignment, therefore the member must be properly aligned to avoid unaligned accesses.
The problem is in place since the initial merge of multicast to unicast:
commit 6db6f0eae6052b70885562e1733896647ec1d807 bridge: multicast to unicast
--- net/bridge/br_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/br_private.h +1 -1
@@ -217,8 +217,8 @@ struct net_bridge_port_group {struct rcu_head rcu;struct timer_list timer;struct br_ip addr; +unsigned char eth_addr[ETH_ALEN ]__aligned(2) ;unsigned char flags; -unsigned char eth_addr[ETH_ALEN ]; };struct net_bridge_mdb_entry {
Signature · 1 line
2.27.0
Quoted 25 lines · Thomas Martitz
The
eth_addrmember is passed toether_addrfunctions that require 2-byte alignment, therefore the member must be properly aligned to avoid unaligned accesses.The problem is in place since the initial merge of multicast to unicast:
commit6db6f0eae6052b70885562e1733896647ec1d807bridge: multicast to unicastFixes 6db6f0eae605 ("bridge: multicast to unicast")Cc Roopa Prabhu <[email protected]>Cc Nikolay Aleksandrov <[email protected]>Cc David S. Miller <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Felix Fietkau <[email protected]>Signed-off-by Thomas Martitz <[email protected]>--- net/bridge/br_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/bridge/br_private.h +0
-0
net/bridge/br_private.h struct net_bridge_port_group { · line 224
Quoted 9 lines
net/bridge/br_private.h +1
-1@@ -217,8 +217,8 @@ struct net_bridge_port_group {struct rcu_head rcu;struct timer_list timer;struct br_ip addr; +unsigned char eth_addr[ETH_ALEN ]__aligned(2) ;unsigned char flags; -unsigned char eth_addr[ETH_ALEN ]; };struct net_bridge_mdb_entry {
Thanks!
David Miller
maintainerFrom: Thomas Martitz <[email protected]>
Date: Thu, 25 Jun 2020 14:26:03 +0200
Quoted 7 lines
The
eth_addrmember is passed toether_addrfunctions that require 2-byte alignment, therefore the member must be properly aligned to avoid unaligned accesses.The problem is in place since the initial merge of multicast to unicast:
commit6db6f0eae6052b70885562e1733896647ec1d807bridge: multicast to unicast
Quoted 8 lines
Fixes 6db6f0eae605 ("bridge: multicast to unicast")Cc Roopa Prabhu <[email protected]>Cc Nikolay Aleksandrov <[email protected]>Cc David S. Miller <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Felix Fietkau <[email protected]>Signed-off-by Thomas Martitz <[email protected]>
Applied and queued up for -stable.
Please do not explicitly CC: stable for networking changes, I take care of those by hand.
Thank you.
Antwort: Re: [PATCH v2] net: bridge: enfore alignment for ethernet address
[email protected] schrieb: -----
Quoted 31 lines
An: [email protected]
Von: "David Miller"
Gesendet von: [email protected]
Datum: 25.06.2020 21:38
Kopie: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Betreff: Re: [PATCH v2] net: bridge: enfore alignment for ethernet addressFrom: Thomas Martitz <[email protected]>
Date: Thu, 25 Jun 2020 14:26:03 +0200Quoted 5 lines
The
eth_addrmember is passed toether_addrfunctions that require 2-byte alignment, therefore the member must be properly aligned to avoid unaligned accesses.The problem is in place since the initial merge of multicast to
unicast:
Quoted 1 line
commit
6db6f0eae6052b70885562e1733896647ec1d807bridge: multicastto unicast
Quoted 9 lines
Fixes 6db6f0eae605 ("bridge: multicast to unicast")Cc Roopa Prabhu <[email protected]>Cc Nikolay Aleksandrov <[email protected]>Cc David S. Miller <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Felix Fietkau <[email protected]>Signed-off-by Thomas Martitz <[email protected]>
Quoted 1 line
Applied and queued up for -stable.
Awesome, thank you! I was about to resend the patch with the Nikolay's Acked-By, but turns out that wasn't necessary.
Quoted 5 lines
Please do not explicitly CC: stable for networking changes, I take care
of those by hand.
Alright, I'll remeber that. This was my very first submission to the kernel, everywhere it is suggested to Cc: stable.
Best regards.