All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mac80211: fix unaligned access in mesh table hash function
@ 2019-03-13 17:54 Felix Fietkau
  0 siblings, 0 replies; only message in thread
From: Felix Fietkau @ 2019-03-13 17:54 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes

The pointer to the last four bytes of the address is not guaranteed to be
aligned, so we need to use __get_unaligned_cpu32 here

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/mac80211/mesh_pathtbl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index 8822c4f3dc48..0a1148328f19 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -23,7 +23,7 @@ static void mesh_path_free_rcu(struct mesh_table *tbl, struct mesh_path *mpath);
 static u32 mesh_table_hash(const void *addr, u32 len, u32 seed)
 {
 	/* Use last four bytes of hw addr as hash index */
-	return jhash_1word(*(u32 *)(addr+2), seed);
+	return jhash_1word(__get_unaligned_cpu32(addr+2), seed);
 }
 
 static const struct rhashtable_params mesh_rht_params = {
-- 
2.17.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-03-13 17:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-13 17:54 [PATCH] mac80211: fix unaligned access in mesh table hash function Felix Fietkau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.