313-mac80211-fix-unaligned-access-in-mesh-table-hash-fun.patch 745 B

123456789101112131415161718192021
  1. From: Felix Fietkau <[email protected]>
  2. Date: Wed, 13 Mar 2019 18:52:56 +0100
  3. Subject: [PATCH] mac80211: fix unaligned access in mesh table hash function
  4. The pointer to the last four bytes of the address is not guaranteed to be
  5. aligned, so we need to use __get_unaligned_cpu32 here
  6. Signed-off-by: Felix Fietkau <[email protected]>
  7. ---
  8. --- a/net/mac80211/mesh_pathtbl.c
  9. +++ b/net/mac80211/mesh_pathtbl.c
  10. @@ -23,7 +23,7 @@ static void mesh_path_free_rcu(struct me
  11. static u32 mesh_table_hash(const void *addr, u32 len, u32 seed)
  12. {
  13. /* Use last four bytes of hw addr as hash index */
  14. - return jhash_1word(*(u32 *)(addr+2), seed);
  15. + return jhash_1word(__get_unaligned_cpu32(addr+2), seed);
  16. }
  17. static const struct rhashtable_params mesh_rht_params = {