Message ID | 20200625065407.1196147-1-t.martitz@avm.de |
---|---|
State | Changes Requested |
Delegated to: | David Miller |
Headers | show |
Series | net: bridge: enfore alignment for ethernet address | expand |
On 25/06/2020 09:54, Thomas Martitz wrote: > 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 > > Fixes: 6db6f0eae605 ("bridge: multicast to unicast") > Cc: Roopa Prabhu <roopa@cumulusnetworks.com> > Cc: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> > Cc: David S. Miller <davem@davemloft.net> > Cc: Jakub Kicinski <kuba@kernel.org> > Cc: Felix Fietkau <nbd@nbd.name> > Cc: stable@vger.kernel.org > Signed-off-by: Thomas Martitz <t.martitz@avm.de> > --- > net/bridge/br_private.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h > index 7501be4eeba0..22cb2f1993ef 100644 > --- a/net/bridge/br_private.h > +++ b/net/bridge/br_private.h > @@ -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
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 7501be4eeba0..22cb2f1993ef 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -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 {
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 Fixes: 6db6f0eae605 ("bridge: multicast to unicast") Cc: Roopa Prabhu <roopa@cumulusnetworks.com> Cc: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Cc: David S. Miller <davem@davemloft.net> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Felix Fietkau <nbd@nbd.name> Cc: stable@vger.kernel.org Signed-off-by: Thomas Martitz <t.martitz@avm.de> --- net/bridge/br_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)