From patchwork Mon Jan 21 07:00:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balaji Pothunoori X-Patchwork-Id: 10772637 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 890F991E for ; Mon, 21 Jan 2019 07:18:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 731D229F0D for ; Mon, 21 Jan 2019 07:18:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6708429F0F; Mon, 21 Jan 2019 07:18:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 096F229F0D for ; Mon, 21 Jan 2019 07:18:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728180AbfAUHSF (ORCPT ); Mon, 21 Jan 2019 02:18:05 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:46710 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726133AbfAUHSF (ORCPT ); Mon, 21 Jan 2019 02:18:05 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C5D1860886; Mon, 21 Jan 2019 07:01:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1548054066; bh=zSqKlmDE3aYmidmuPQidcOZX3yNXyCpcIRvbo6IPouE=; h=From:To:Cc:Subject:Date:From; b=Z2D7XcvcIKzzakg7NRdEcWo4ab+tB6w1Z81eRrlQUoBSt+F9BWbPbXWxGfuAuLXhx SmplmDyfeYCI3163xBoLM0U7pMu6ny+N+9wth7qUSbjoN4LHi8WpCr+5WoMntcAw9z 6WVuzZTYflfT5ealwjGyBk4OGwbt1w/bC/0huxRk= Received: from checstex0244823-lin.qca.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: bpothuno@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id A198160860; Mon, 21 Jan 2019 07:01:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1548054066; bh=zSqKlmDE3aYmidmuPQidcOZX3yNXyCpcIRvbo6IPouE=; h=From:To:Cc:Subject:Date:From; b=Z2D7XcvcIKzzakg7NRdEcWo4ab+tB6w1Z81eRrlQUoBSt+F9BWbPbXWxGfuAuLXhx SmplmDyfeYCI3163xBoLM0U7pMu6ny+N+9wth7qUSbjoN4LHi8WpCr+5WoMntcAw9z 6WVuzZTYflfT5ealwjGyBk4OGwbt1w/bC/0huxRk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A198160860 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=bpothuno@codeaurora.org From: Balaji Pothunoori To: johannes@sipsolutions.net Cc: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, Balaji Pothunoori Subject: [PATCH] mac80211: don't initiate TDLS connection if station is not associated to AP Date: Mon, 21 Jan 2019 12:30:43 +0530 Message-Id: <1548054043-446-1-git-send-email-bpothuno@codeaurora.org> X-Mailer: git-send-email 2.7.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- net/mac80211/cfg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 80d8ebc..d65aa01 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1498,6 +1498,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);