Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp205451imj; Thu, 14 Feb 2019 18:39:41 -0800 (PST) X-Google-Smtp-Source: AHgI3Iaud0uEHO+VfTbt1lz+Z+EjRAHsPRsVatoszPskudH2gdJnS5PqIy53ypO+I2bDljt0DqLi X-Received: by 2002:a62:3141:: with SMTP id x62mr7418558pfx.12.1550198381084; Thu, 14 Feb 2019 18:39:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550198381; cv=none; d=google.com; s=arc-20160816; b=n5G/OlTtvUQcJD6wy0NEDbA0TizeKhz5y78hUyIxr4/rMH/IG6qLTqdOf7oPeBr6jR bnxVK/RYQo5DvOqjA4tzEuOIXMzyBAVVN/0CGua49Xy/tEE1Duhx29gUpdZGh/GVCs5F b98/YTrG/npzwrdmEtGBR6q1gp5NaUTPNZXiEO6+cAWIfMBqSn2p6VAH+G3JSyxFn4l5 twpJ6Ka5ltCurP97JBMchmPxag/zKnbLjdsCKwLC9/TD/tnCi+LzI6gnMcz0132uZ1LB mQ9v+sioDYP7bS0ip3d9LpmnETyI4y6USuup9iv7OiK1G255YsfHDwv0EgZAthSjIEeJ VaoA== 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=xg+bBaE4/tVtqCkuo4F981K/uKJataP+ecB760ohunM=; b=AInnxAAAnj+8h0p9uXX3hbxWShS/kCaBmcfUtVpJbo8NNuBEw924MHecrxfLKRkGoi KdjVHMGBqIIS/NkgCYiUK64AnFRfwepu13WGZKxllxhb2cBxcLeSOtf49+nmxSszqDK6 V8IQUG0HeR5Dsq/Fu/CS1zkmKjYrHAbpdn26CE7/EqoISRnPO0NfldXo1x4WNHjQCgMK UmO4u2gZDK3novCbRdrvG6V5/TEOmpMI5pm8c4U64vPkVPp9vX2hTlfv/BnEuTN7zS+u VQlrVQtp0PqYIzWzeayP1UX8yKWX7w7ahYMGGiQWmdwOtgpPnEqo38EaglrrOwArzAYe EDuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F31mJ0oo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id k1si4171167pls.186.2019.02.14.18.39.25; Thu, 14 Feb 2019 18:39:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F31mJ0oo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1732098AbfBOCf5 (ORCPT + 99 others); Thu, 14 Feb 2019 21:35:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:51110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732069AbfBOCLB (ORCPT ); Thu, 14 Feb 2019 21:11:01 -0500 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 056C821B68; Fri, 15 Feb 2019 02:10:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550196660; bh=E9ZK8Dte9OCSoUfF8/3j1kFQPkY9l+mmzYlnyaLt0qU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F31mJ0oopQ7Borjpho8NnRF908iCyqcB35X40jcfgQev3s+jTOwqeiNRQMEOrfoLw dPdc90GgERXy7SxtC5sdoaIteqeVPK8U7LvPnxqk98cf/p3vbLVsWI0EsbBV9j5vuM 7pviAp4sOaDJ1vlMGYJwOPWPNPNQS4QKdJ74eWVM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Balaji Pothunoori , Johannes Berg , Sasha Levin , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.20 70/77] mac80211: don't initiate TDLS connection if station is not associated to AP Date: Thu, 14 Feb 2019 21:08:48 -0500 Message-Id: <20190215020855.176727-70-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190215020855.176727-1-sashal@kernel.org> References: <20190215020855.176727-1-sashal@kernel.org> MIME-Version: 1.0 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: Balaji Pothunoori [ Upstream commit 7ed5285396c257fd4070b1e29e7b2341aae2a1ce ] Following call trace is observed while adding TDLS peer entry in driver during TDLS setup. Call Trace: [] dump_stack+0x47/0x61 [] __warn+0xe2/0x100 [] ? sta_apply_parameters+0x49f/0x550 [mac80211] [] warn_slowpath_null+0x25/0x30 [] sta_apply_parameters+0x49f/0x550 [mac80211] [] ? sta_info_alloc+0x1c2/0x450 [mac80211] [] ieee80211_add_station+0xe3/0x160 [mac80211] [] nl80211_new_station+0x273/0x420 [] genl_rcv_msg+0x219/0x3c0 [] ? genl_rcv+0x30/0x30 [] netlink_rcv_skb+0x8e/0xb0 [] genl_rcv+0x1c/0x30 [] netlink_unicast+0x13a/0x1d0 [] netlink_sendmsg+0x2d8/0x390 [] sock_sendmsg+0x2d/0x40 [] ___sys_sendmsg+0x1d9/0x1e0 Fixing this by allowing TDLS setup request only when we have completed association. Signed-off-by: Balaji Pothunoori Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/cfg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 818aa0060349..04337e6be7f0 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1490,6 +1490,10 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) sta->sta.tdls = true; + if (sta->sta.tdls && sdata->vif.type == NL80211_IFTYPE_STATION && + !sdata->u.mgd.associated) + return -EINVAL; + err = sta_apply_parameters(local, sta, params); if (err) { sta_info_free(local, sta); -- 2.19.1