netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: bridge: enfore alignment for ethernet address
@ 2020-06-25  6:54 Thomas Martitz
  2020-06-25 11:54 ` Nikolay Aleksandrov
  2020-06-25 12:26 ` [PATCH v2] " Thomas Martitz
  0 siblings, 2 replies; 6+ messages in thread
From: Thomas Martitz @ 2020-06-25  6:54 UTC (permalink / raw)
  To: netdev
  Cc: Thomas Martitz, Roopa Prabhu, Nikolay Aleksandrov,
	David S . Miller, Jakub Kicinski, Felix Fietkau, stable

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 {
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] net: bridge: enfore alignment for ethernet address
  2020-06-25  6:54 [PATCH] net: bridge: enfore alignment for ethernet address Thomas Martitz
@ 2020-06-25 11:54 ` Nikolay Aleksandrov
  2020-06-25 12:26 ` [PATCH v2] " Thomas Martitz
  1 sibling, 0 replies; 6+ messages in thread
From: Nikolay Aleksandrov @ 2020-06-25 11:54 UTC (permalink / raw)
  To: Thomas Martitz, netdev
  Cc: Roopa Prabhu, David S . Miller, Jakub Kicinski, Felix Fietkau, stable

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] net: bridge: enfore alignment for ethernet address
  2020-06-25  6:54 [PATCH] net: bridge: enfore alignment for ethernet address Thomas Martitz
  2020-06-25 11:54 ` Nikolay Aleksandrov
@ 2020-06-25 12:26 ` Thomas Martitz
  2020-06-25 12:29   ` Nikolay Aleksandrov
                     ` (2 more replies)
  1 sibling, 3 replies; 6+ messages in thread
From: Thomas Martitz @ 2020-06-25 12:26 UTC (permalink / raw)
  To: netdev
  Cc: Thomas Martitz, Roopa Prabhu, Nikolay Aleksandrov,
	David S . Miller, Jakub Kicinski, Felix Fietkau, stable

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..2130fe0194e6 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] __aligned(2);
 	unsigned char			flags;
-	unsigned char			eth_addr[ETH_ALEN];
 };
 
 struct net_bridge_mdb_entry {
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] net: bridge: enfore alignment for ethernet address
  2020-06-25 12:26 ` [PATCH v2] " Thomas Martitz
@ 2020-06-25 12:29   ` Nikolay Aleksandrov
  2020-06-25 19:38   ` David Miller
  2020-06-25 19:51   ` Antwort: " t.martitz
  2 siblings, 0 replies; 6+ messages in thread
From: Nikolay Aleksandrov @ 2020-06-25 12:29 UTC (permalink / raw)
  To: Thomas Martitz, netdev
  Cc: Roopa Prabhu, David S . Miller, Jakub Kicinski, Felix Fietkau, stable

On 25/06/2020 15:26, 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..2130fe0194e6 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] __aligned(2);
>  	unsigned char			flags;
> -	unsigned char			eth_addr[ETH_ALEN];
>  };
>  
>  struct net_bridge_mdb_entry {
> 

Thanks!
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] net: bridge: enfore alignment for ethernet address
  2020-06-25 12:26 ` [PATCH v2] " Thomas Martitz
  2020-06-25 12:29   ` Nikolay Aleksandrov
@ 2020-06-25 19:38   ` David Miller
  2020-06-25 19:51   ` Antwort: " t.martitz
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-06-25 19:38 UTC (permalink / raw)
  To: t.martitz; +Cc: netdev, roopa, nikolay, kuba, nbd, stable

From: Thomas Martitz <t.martitz@avm.de>
Date: Thu, 25 Jun 2020 14:26:03 +0200

> 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>

Applied and queued up for -stable.

Please do not explicitly CC: stable for networking changes, I take care
of those by hand.

Thank you.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Antwort: Re: [PATCH v2] net: bridge: enfore alignment for ethernet address
  2020-06-25 12:26 ` [PATCH v2] " Thomas Martitz
  2020-06-25 12:29   ` Nikolay Aleksandrov
  2020-06-25 19:38   ` David Miller
@ 2020-06-25 19:51   ` t.martitz
  2 siblings, 0 replies; 6+ messages in thread
From: t.martitz @ 2020-06-25 19:51 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, roopa, nikolay, kuba, nbd, stable



-----netdev-owner@vger.kernel.org schrieb: -----

>An: t.martitz@avm.de
>Von: "David Miller" 
>Gesendet von: netdev-owner@vger.kernel.org
>Datum: 25.06.2020 21:38
>Kopie: netdev@vger.kernel.org, roopa@cumulusnetworks.com,
>nikolay@cumulusnetworks.com, kuba@kernel.org, nbd@nbd.name,
>stable@vger.kernel.org
>Betreff: Re: [PATCH v2] net: bridge: enfore alignment for ethernet
>address
>
>From: Thomas Martitz <t.martitz@avm.de>
>Date: Thu, 25 Jun 2020 14:26:03 +0200
>
>> 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>
>
>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.

>
>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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-06-25 19:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-25  6:54 [PATCH] net: bridge: enfore alignment for ethernet address Thomas Martitz
2020-06-25 11:54 ` Nikolay Aleksandrov
2020-06-25 12:26 ` [PATCH v2] " Thomas Martitz
2020-06-25 12:29   ` Nikolay Aleksandrov
2020-06-25 19:38   ` David Miller
2020-06-25 19:51   ` Antwort: " t.martitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).