netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] neighbour: fix unaligned access to pneigh_entry
@ 2023-05-31 10:42 Qingfang DENG
  2023-05-31 18:16 ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Qingfang DENG @ 2023-05-31 10:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	YOSHIFUJI Hideaki, Ville Nuorvala, Masahide NAKAMURA, netdev,
	linux-kernel
  Cc: Qingfang DENG

From: Qingfang DENG <qingfang.deng@siflower.com.cn>

After the blamed commit, the member key is longer 4-byte aligned. On
platforms that do not support unaligned access, e.g., MIPS32R2 with
unaligned_action set to 2, this will trigger a crash when accessing
an IPv6 pneigh_entry, as the key is cast to an in6_addr pointer.

Align the member to 4 bytes on said platforms.

Fixes: 62dd93181aaa ("[IPV6] NDISC: Set per-entry is_router flag in Proxy NA.")
Signed-off-by: Qingfang DENG <qingfang.deng@siflower.com.cn>
---
 include/net/neighbour.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 3fa5774bddac..c0195ed9d111 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -180,7 +180,11 @@ struct pneigh_entry {
 	netdevice_tracker	dev_tracker;
 	u32			flags;
 	u8			protocol;
+#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
 	u8			key[];
+#else
+	u8			key[] __aligned(4);
+#endif
 };
 
 /*
-- 
2.34.1


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

end of thread, other threads:[~2023-06-02  4:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-31 10:42 [PATCH net] neighbour: fix unaligned access to pneigh_entry Qingfang DENG
2023-05-31 18:16 ` Jakub Kicinski
2023-05-31 18:41   ` Eric Dumazet
2023-06-01  1:54     ` [PATCH net v2] " Qingfang DENG
2023-06-02  4:50       ` patchwork-bot+netdevbpf

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