summaryrefslogtreecommitdiff
authorFelix Fietkau <nbd@nbd.name>2019-03-13 17:54:27 (GMT)
committer Greg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-16 17:43:41 (GMT)
commit7e0642ec73e0b26b00f3e570266a21639058aa6f (patch)
tree19bd41ca1154c51deeba2ee435570dae69a0e6d6
parentee734a2a39b6633248a066ab0a8dffdaa6085b8a (diff)
downloadcommon-7e0642ec73e0b26b00f3e570266a21639058aa6f.zip
common-7e0642ec73e0b26b00f3e570266a21639058aa6f.tar.gz
common-7e0642ec73e0b26b00f3e570266a21639058aa6f.tar.bz2
mac80211: fix unaligned access in mesh table hash function
[ Upstream commit 40586e3fc400c00c11151804dcdc93f8c831c808 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat
-rw-r--r--net/mac80211/mesh_pathtbl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index 197753a..8c17d49 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((u8 *)addr + 2), seed);
}
static const struct rhashtable_params mesh_rht_params = {