netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Oetken <ennoerlangen@gmail.com>
To: "David S . Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Cc: Andreas Oetken <ennoerlangen@gmail.com>,
	Andreas Oetken <andreas.oetken@siemens.com>
Subject: [PATCH v1] net: hsr: align sup_multicast_addr in struct hsr_priv to u16 boundary
Date: Tue,  2 Feb 2021 10:03:04 +0100	[thread overview]
Message-ID: <20210202090304.2740471-1-ennoerlangen@gmail.com> (raw)

From: Andreas Oetken <andreas.oetken@siemens.com>

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>
---
 net/hsr/hsr_main.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/hsr/hsr_main.h b/net/hsr/hsr_main.h
index 7dc92ce5a134..a9c30a608e35 100644
--- a/net/hsr/hsr_main.h
+++ b/net/hsr/hsr_main.h
@@ -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
-- 
2.30.0


             reply	other threads:[~2021-02-02 10:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02  9:03 Andreas Oetken [this message]
2021-02-02 17:00 ` [PATCH v1] net: hsr: align sup_multicast_addr in struct hsr_priv to u16 boundary patchwork-bot+netdevbpf
  -- strict thread matches above, loose matches on Subject: below --
2021-02-02  9:13 Andreas Oetken

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210202090304.2740471-1-ennoerlangen@gmail.com \
    --to=ennoerlangen@gmail.com \
    --cc=andreas.oetken@siemens.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).