Commit 7e0642ec authored by Felix Fietkau's avatar Felix Fietkau Committed by Greg Kroah-Hartman

mac80211: fix unaligned access in mesh table hash function

[ Upstream commit 40586e3f ]

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: default avatarFelix Fietkau <nbd@nbd.name>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent ee734a2a
...@@ -23,7 +23,7 @@ static void mesh_path_free_rcu(struct mesh_table *tbl, struct mesh_path *mpath); ...@@ -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) static u32 mesh_table_hash(const void *addr, u32 len, u32 seed)
{ {
/* Use last four bytes of hw addr as hash index */ /* Use last four bytes of hw addr as hash index */
return jhash_1word(*(u32 *)(addr+2), seed); return jhash_1word(__get_unaligned_cpu32((u8 *)addr + 2), seed);
} }
static const struct rhashtable_params mesh_rht_params = { static const struct rhashtable_params mesh_rht_params = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment