Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Felix Fietkau and committed by
Johannes Berg
40586e3f b49c15e1

+1 -1
+1 -1
net/mac80211/mesh_pathtbl.c
··· 23 23 static u32 mesh_table_hash(const void *addr, u32 len, u32 seed) 24 24 { 25 25 /* Use last four bytes of hw addr as hash index */ 26 - return jhash_1word(*(u32 *)(addr+2), seed); 26 + return jhash_1word(__get_unaligned_cpu32((u8 *)addr + 2), seed); 27 27 } 28 28 29 29 static const struct rhashtable_params mesh_rht_params = {