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: 10772583 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 DAFB01390 for ; Mon, 21 Jan 2019 07:01:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2FB829F26 for ; Mon, 21 Jan 2019 07:01:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C137A29F28; Mon, 21 Jan 2019 07:01:14 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6EED629F29 for ; Mon, 21 Jan 2019 07:01:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=3wPr/My7N6TIl3L7236lk6h1SzdFSdeN6ActobcwzWo=; b=itE Fw47cMFG8MnRX1ZfL44v9zHIQP2BljvRoRxFxFHCgQ/yVBDF6X9P51VxKtn2Lsa246v083BP3emvl xXh0OYGMosYuUbQEpdW19c1B6ZfPYzPPp+gOMIPFPsgqSJifOh5d1/UVpQ84b/ngSH5uvEtEKQIOQ gxoCpeJhpNDCqfjvf8BsGqp3oU4slxq+xNdVPh14TXGx2QnRnfca73h+xt9yQt2DLoUtGyL2wASYR BHAcJ6URTTvln82nxrQ56LVPQTFdiL/nypSve7mIwBXW3evS256rr3VPfor61cb2ajqRNfeuVlyr+ bLY6nkbl7v0t+kBS0DvBzu3r0+6yYLw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1glTa3-0002JF-FI; Mon, 21 Jan 2019 07:01:11 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1glTa0-0002Ia-Oa for ath10k@lists.infradead.org; Mon, 21 Jan 2019 07:01:10 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 948A56087D; 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190120_230108_821833_0488A6D8 X-CRM114-Status: UNSURE ( 8.57 ) X-CRM114-Notice: Please train this message. X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Balaji Pothunoori , linux-wireless@vger.kernel.org, ath10k@lists.infradead.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.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);