From patchwork Mon Feb 29 21:32:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maya Erez X-Patchwork-Id: 8458441 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 118C69F65E for ; Mon, 29 Feb 2016 21:33:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 42812201FE for ; Mon, 29 Feb 2016 21:33:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 41F0B20220 for ; Mon, 29 Feb 2016 21:33:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752013AbcB2VdA (ORCPT ); Mon, 29 Feb 2016 16:33:00 -0500 Received: from wolverine01.qualcomm.com ([199.106.114.254]:42548 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751896AbcB2Vc7 (ORCPT ); Mon, 29 Feb 2016 16:32:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1456781579; x=1488317579; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=aHq3q2i1xRBFLeBNNnnqX7ci58IZnH2oK5qPwGcZVQo=; b=Hm7wNwV3YHa7pBKO93gO2QaNILUiaY4pBQueG2E2ISDsdv7Lrc+ArjN7 xT7KGnkXr3zRlPkL9ULYgVVdXP51SdTvT4NmWGgiux4LcSqc6kXgoA6ZO Mc1LSBjl/vJrQVxdEcnUwP6dfGW1iaOaMHXRWuSdvZit2Ls1/zGb0UpmZ 0=; X-IronPort-AV: E=Sophos;i="5.22,521,1449561600"; d="scan'208";a="172806775" Received: from ironmsg04-r-new.qualcomm.com (HELO Ironmsg04-R.qualcomm.com) ([10.53.140.108]) by wolverine01.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 29 Feb 2016 13:32:58 -0800 X-IronPort-AV: E=McAfee;i="5700,7163,8090"; a="1147518560" Received: from lx-merez.mea.qualcomm.com ([10.18.177.171]) by Ironmsg04-R.qualcomm.com with ESMTP; 29 Feb 2016 13:32:57 -0800 From: Maya Erez To: Kalle Valo Cc: Maya Erez , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com Subject: [PATCH 02/15] wil6210: AP: prevent connecting to already connected station Date: Mon, 29 Feb 2016 23:32:37 +0200 Message-Id: <1456781570-16552-3-git-send-email-qca_merez@qca.qualcomm.com> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1456781570-16552-1-git-send-email-qca_merez@qca.qualcomm.com> References: <1456781570-16552-1-git-send-email-qca_merez@qca.qualcomm.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP wmi_evt_connect doesn't check if the connect event is received for an already connected station. This can lead to memory leak as a new vring is allocated without freeing the previously allocated vring and to unexpected behavior of nl80211 layer due to unexpected notification of a new station. Add a check in wmi_evt_connect in AP mode to verify that the requested CID is not associated to an already connected station. Signed-off-by: Maya Erez --- drivers/net/wireless/ath/wil6210/wmi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c index 493e721..fb09035 100644 --- a/drivers/net/wireless/ath/wil6210/wmi.c +++ b/drivers/net/wireless/ath/wil6210/wmi.c @@ -487,6 +487,14 @@ static void wmi_evt_connect(struct wil6210_priv *wil, int id, void *d, int len) return; } del_timer_sync(&wil->connect_timer); + } else if ((wdev->iftype == NL80211_IFTYPE_AP) || + (wdev->iftype == NL80211_IFTYPE_P2P_GO)) { + if (wil->sta[evt->cid].status != wil_sta_unused) { + wil_err(wil, "%s: AP: Invalid status %d for CID %d\n", + __func__, wil->sta[evt->cid].status, evt->cid); + mutex_unlock(&wil->mutex); + return; + } } /* FIXME FW can transmit only ucast frames to peer */