Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp871851ybt; Fri, 19 Jun 2020 16:28:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSZI0ElUU8EfU0zy+F/7LmfkTzkocv243XQ3b3iLQN7BYcMN37lYHFGGGL8vYuk0/rXgRn X-Received: by 2002:a17:906:90b:: with SMTP id i11mr5678725ejd.343.1592609335852; Fri, 19 Jun 2020 16:28:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592609335; cv=none; d=google.com; s=arc-20160816; b=DGb+tq/9mcpztuRqE/Glm6gYjKtXRkQ8+B6ZuSi/TLrsMp10QdiLQHmxcU/OX/HhQ4 IkI8NHj+wK8ys0kxxl3cUXFwpaoIxbbWv48G/xAAZRdzM2DHmKokFqept2jK18MW31bT z1Nr2qHB68cJhV4IJmu3hL/Sh7DlvkVFWH0idTbpi6aI25PUCrlyMAOThYwes0qzo+V1 PMjDTX3cBvzN27WU89rDzRSj/etjP73VMnn4YKhaFIlE9XTjGEL76jIOnIa38Qez91kd y5ZgdzsbhCA7/Hi/P55kmKo9jbS27eIHPR6F4lIBwA9wssoZ5BwzDt1+GDwnCAp91x2n MQ/w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nUmSfBOg+zOLUSAQth8NvuGWQH1WhDoaOKJAvLLO7nM=; b=s21L7kbzX3hIx7HBrDtmT76ss2u75pyYIxLr0GMjWcGZ1VIoRwlEdKBO+Ba7WFGZQK FweGe8GRd/WG8YI8JAP+n15Ucz6ReHmffqjZkaMbKSWQHe0cwrhqsYcbIWSOoxOq7oc+ sX3I4lmHzDLrGRT+xRqC9q/KqcbX9xyMV1EWUfU5rS+FVDJgHXhqsolt+rzHYGi3Ue82 3GhHrIlSSRHQoRCP/6yJGvulgog69Eiq89QKXxDrRt4u+pHqqLhXthZVZecQ7HuAigq5 e0w+cxJJWAcQyS1zrLI6A1e0JRKZ1lj+Xt24jf34Y6AGoj/jS+056kmlrPv4eTK9Cui2 rXBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tHcy31PI; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e7si4853058ejc.314.2020.06.19.16.28.31; Fri, 19 Jun 2020 16:28:55 -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=tHcy31PI; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404445AbgFSP1z (ORCPT + 99 others); Fri, 19 Jun 2020 11:27:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:58558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393304AbgFSP0q (ORCPT ); Fri, 19 Jun 2020 11:26:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 98E8421582; Fri, 19 Jun 2020 15:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592580405; bh=6qFB+xmqfN7wt3Btr+n50UrRMA+WUXiQ88tCbhKAgm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tHcy31PIp4zTjths5IxpD6ennokxBpCNxH8OxSd+DSn3na9KoodJvt8vL5pFjJj44 8Qelp0plIjgQeoi73JQ3yJcu/DdnOuQ50kkOh5bVLQfzRBosWLNGwIQ5TQYnyUR6ex 4tAKqz1Dkd/BKMSMKVwtCQ16873gtgC8gkp1kWGU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sharon , Luca Coelho , Sasha Levin Subject: [PATCH 5.7 236/376] iwlwifi: mvm: fix aux station leak Date: Fri, 19 Jun 2020 16:32:34 +0200 Message-Id: <20200619141721.494826630@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141710.350494719@linuxfoundation.org> References: <20200619141710.350494719@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sharon [ Upstream commit f327236df2afc8c3c711e7e070f122c26974f4da ] When mvm is initialized we alloc aux station with aux queue. We later free the station memory when driver is stopped, but we never free the queue's memory, which casues a leak. Add a proper de-initialization of the station. Signed-off-by: Sharon Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20200529092401.0121c5be55e9.Id7516fbb3482131d0c9dfb51ff20b226617ddb49@changeid Signed-off-by: Sasha Levin --- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 5 ++--- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 18 +++++++++++++----- drivers/net/wireless/intel/iwlwifi/mvm/sta.h | 6 +++--- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 7aa1350b093e..cf3c46c9b1ee 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -1209,14 +1209,13 @@ void __iwl_mvm_mac_stop(struct iwl_mvm *mvm) */ flush_work(&mvm->roc_done_wk); + iwl_mvm_rm_aux_sta(mvm); + iwl_mvm_stop_device(mvm); iwl_mvm_async_handlers_purge(mvm); /* async_handlers_list is empty and will stay empty: HW is stopped */ - /* the fw is stopped, the aux sta is dead: clean up driver state */ - iwl_mvm_del_aux_sta(mvm); - /* * Clear IN_HW_RESTART and HW_RESTART_REQUESTED flag when stopping the * hw (as restart_complete() won't be called in this case) and mac80211 diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c index 56ae72debb96..07ca8c91499d 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c @@ -2080,16 +2080,24 @@ int iwl_mvm_rm_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) return ret; } -void iwl_mvm_dealloc_snif_sta(struct iwl_mvm *mvm) +int iwl_mvm_rm_aux_sta(struct iwl_mvm *mvm) { - iwl_mvm_dealloc_int_sta(mvm, &mvm->snif_sta); -} + int ret; -void iwl_mvm_del_aux_sta(struct iwl_mvm *mvm) -{ lockdep_assert_held(&mvm->mutex); + iwl_mvm_disable_txq(mvm, NULL, mvm->aux_queue, IWL_MAX_TID_COUNT, 0); + ret = iwl_mvm_rm_sta_common(mvm, mvm->aux_sta.sta_id); + if (ret) + IWL_WARN(mvm, "Failed sending remove station\n"); iwl_mvm_dealloc_int_sta(mvm, &mvm->aux_sta); + + return ret; +} + +void iwl_mvm_dealloc_snif_sta(struct iwl_mvm *mvm) +{ + iwl_mvm_dealloc_int_sta(mvm, &mvm->snif_sta); } /* diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h index 8d70093847cb..da2d1ac01229 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h @@ -8,7 +8,7 @@ * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH * Copyright(c) 2015 - 2016 Intel Deutschland GmbH - * Copyright(c) 2018 - 2019 Intel Corporation + * Copyright(c) 2018 - 2020 Intel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as @@ -31,7 +31,7 @@ * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH * Copyright(c) 2015 - 2016 Intel Deutschland GmbH - * Copyright(c) 2018 - 2019 Intel Corporation + * Copyright(c) 2018 - 2020 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -541,7 +541,7 @@ int iwl_mvm_sta_tx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, int tid, u8 queue, bool start); int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm); -void iwl_mvm_del_aux_sta(struct iwl_mvm *mvm); +int iwl_mvm_rm_aux_sta(struct iwl_mvm *mvm); int iwl_mvm_alloc_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif); int iwl_mvm_send_add_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif); -- 2.25.1