mac80211: fix an unaligned access in the mesh hash table function
authorFelix Fietkau <nbd@nbd.name>
Wed, 13 Mar 2019 19:04:44 +0000 (20:04 +0100)
committerFelix Fietkau <nbd@nbd.name>
Sat, 16 Mar 2019 18:59:02 +0000 (19:59 +0100)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/kernel/mac80211/patches/subsys/313-mac80211-fix-unaligned-access-in-mesh-table-hash-fun.patch [new file with mode: 0644]

diff --git a/package/kernel/mac80211/patches/subsys/313-mac80211-fix-unaligned-access-in-mesh-table-hash-fun.patch b/package/kernel/mac80211/patches/subsys/313-mac80211-fix-unaligned-access-in-mesh-table-hash-fun.patch
new file mode 100644 (file)
index 0000000..2ce2358
--- /dev/null
@@ -0,0 +1,21 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Wed, 13 Mar 2019 18:52:56 +0100
+Subject: [PATCH] mac80211: fix unaligned access in mesh table hash function
+
+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>
+---
+
+--- a/net/mac80211/mesh_pathtbl.c
++++ b/net/mac80211/mesh_pathtbl.c
+@@ -23,7 +23,7 @@ static void mesh_path_free_rcu(struct me
+ 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 = {