From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS, T_DKIMWL_WL_HIGH,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DDEBC004C9 for ; Tue, 7 May 2019 05:53:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 074CF2054F for ; Tue, 7 May 2019 05:53:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557208436; bh=1om1prPh/fUxiWVH5sCRHqUzZnE611qvGwpyoSgJVEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=H2TGrj2hcNUas2+bn0KYHjB0zs46cAau075JHgfaaG8eubv/6WsE01ycc/bNBpFrs kZ+PuszncpHyQ6KUSaNKM808DyKOi35tjuPIxhU3at3pRpo5War27hByLnvOAPiWZf ZfbzhenUHjgzrhSJx+HcSomeorIYTb1r9+/IsEKM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728710AbfEGFij (ORCPT ); Tue, 7 May 2019 01:38:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:58372 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728700AbfEGFig (ORCPT ); Tue, 7 May 2019 01:38:36 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 02E26206A3; Tue, 7 May 2019 05:38:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557207515; bh=1om1prPh/fUxiWVH5sCRHqUzZnE611qvGwpyoSgJVEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SRUe76/7hGH1LR6J45N2+rBurE7SdWP9xR8u6cZbIRPxErZHYpIVeGE5qIPh2g+h4 Xgzk7RcB2W9yPEtyfNTrd9/HE9+RTs52m489lQEpUwwuFIh4DQtTDVV4/1bGc/3IG2 nFSaA4BjLGkBwwal6kJjd0xp1BSSfFwkNZix+/1E= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Felix Fietkau , Johannes Berg , Sasha Levin , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 08/95] mac80211: fix unaligned access in mesh table hash function Date: Tue, 7 May 2019 01:36:57 -0400 Message-Id: <20190507053826.31622-8-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190507053826.31622-1-sashal@kernel.org> References: <20190507053826.31622-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Felix Fietkau [ 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 Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/mesh_pathtbl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 1ce068865629..130022091205 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 = { -- 2.20.1