Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp558753ybz; Fri, 24 Apr 2020 05:25:19 -0700 (PDT) X-Google-Smtp-Source: APiQypJeo3M8EjD8lxTVhV3KulmR8Tx/BWztgXDYn5zt1XIFJQBuhLl5pkIQzzT+0xYvNRF7W0FO X-Received: by 2002:a17:906:1490:: with SMTP id x16mr6389406ejc.323.1587731119421; Fri, 24 Apr 2020 05:25:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587731119; cv=none; d=google.com; s=arc-20160816; b=q3UKjglnRbjqkGH+tR/1hRCcuSrlQLtXbqT9eVj2RCmsORmAEmjuG7kZH+fZEDLEl+ 7J/G1pQLE7kbokR+IT3xy27lyGCkA7+Ds9L6dGTdyQvhLo3CP7zAIhC3WQtSt7JvmEM/ SGseFM1/VjJaTx143mOAINhYQUl0sUe2L3Ru0sntX9KtVXhCbyNhgIj+ODQJHV+xYm2O /avcEA/lllCUu6TdKouUFW6FP8xt59CAPtHuur+31tXtJ7vdE0Z1i70so0FZyMHTaP/q j3EUJ+fgysWmEzwXvMNfgNfKp82/XIS9+rQcnrrK44fCe18iOVi2KLlcFp/jnH+0W8gN q4IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZJObl4NaAVF027wqG6r3w7PFuCKNiV+wsCNHdbfpGVE=; b=G+3n86I/IxAaMbYwwHGZI7/TLm1h2wls1N3r0OvbqWHbbGJrOYl4cnwIRyJlRrHtVu ztt6p7MSXIsb3VqdXd+tx9dsNpKweHIlffnQKO1f7oOSi+SMsUsyGoo91OYN2RwUDeSK CyuZ9VKM5vMdImUXjI5IczL09ELdja2XoD4+96+FDqWF1XYIeogFcjaza7VF4xBEfw9t g46UiBkRtnbPmMs53rWTStMDz09yUX8KjdJRBVjtq5UwvRCBlKl3O0rg5x4EeNzFqLuH oXzDyjso7KmByr4TNxfBVn+loRv4GWhaxKm6lka2ty3e3kmuN34wdv7UksZek5z5gjFO Au6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ce2KMzcw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s29si3052331edi.340.2020.04.24.05.24.54; Fri, 24 Apr 2020 05:25:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ce2KMzcw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727850AbgDXMXJ (ORCPT + 99 others); Fri, 24 Apr 2020 08:23:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:52584 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727825AbgDXMXH (ORCPT ); Fri, 24 Apr 2020 08:23:07 -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 CD69B2087E; Fri, 24 Apr 2020 12:23:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587730986; bh=t6QrlUuqm7H12f/LEkP2lMqOz6UI8P+PkX2WkGbdVLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ce2KMzcwtR1jHYB2iMVnQZ2AWFQNnrLnW3oEUCfVZMskCTvM1nMjyERAm9QOolKfo ARKRMog7pVaaZnPjDO93g9dU7LuWh5m2YcsBt8Wkv5B10s50IqjCmrkd6Z07ywy3b9 5+qKE9Ahx/F72Tz0mGJO2bLeuJ/HmS9H8eIT3d98= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tamizh chelvam , Johannes Berg , Sasha Levin , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.6 25/38] mac80211: fix channel switch trigger from unknown mesh peer Date: Fri, 24 Apr 2020 08:22:23 -0400 Message-Id: <20200424122237.9831-25-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200424122237.9831-1-sashal@kernel.org> References: <20200424122237.9831-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tamizh chelvam [ Upstream commit 93e2d04a1888668183f3fb48666e90b9b31d29e6 ] Previously mesh channel switch happens if beacon contains CSA IE without checking the mesh peer info. Due to that channel switch happens even if the beacon is not from its own mesh peer. Fixing that by checking if the CSA originated from the same mesh network before proceeding for channel switch. Signed-off-by: Tamizh chelvam Link: https://lore.kernel.org/r/1585403604-29274-1-git-send-email-tamizhr@codeaurora.org Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/mesh.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index d09b3c789314d..36978a0e50001 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -1257,15 +1257,15 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, sdata->u.mesh.mshcfg.rssi_threshold < rx_status->signal) mesh_neighbour_update(sdata, mgmt->sa, &elems, rx_status); + + if (ifmsh->csa_role != IEEE80211_MESH_CSA_ROLE_INIT && + !sdata->vif.csa_active) + ieee80211_mesh_process_chnswitch(sdata, &elems, true); } if (ifmsh->sync_ops) ifmsh->sync_ops->rx_bcn_presp(sdata, stype, mgmt, &elems, rx_status); - - if (ifmsh->csa_role != IEEE80211_MESH_CSA_ROLE_INIT && - !sdata->vif.csa_active) - ieee80211_mesh_process_chnswitch(sdata, &elems, true); } int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata) @@ -1373,6 +1373,9 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata, ieee802_11_parse_elems(pos, len - baselen, true, &elems, mgmt->bssid, NULL); + if (!mesh_matches_local(sdata, &elems)) + return; + ifmsh->chsw_ttl = elems.mesh_chansw_params_ie->mesh_ttl; if (!--ifmsh->chsw_ttl) fwd_csa = false; -- 2.20.1