Received: by 10.213.65.68 with SMTP id h4csp467761imn; Fri, 16 Mar 2018 08:39:04 -0700 (PDT) X-Google-Smtp-Source: AG47ELu2m3VZJ0jB8J8r9U9FVlWwfyi3v1wCtUZEsL0F5JoAjgVwntnNiuvftY3vWhMta/iign2Q X-Received: by 2002:a17:902:7c15:: with SMTP id x21-v6mr2595703pll.3.1521214743983; Fri, 16 Mar 2018 08:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521214743; cv=none; d=google.com; s=arc-20160816; b=FGnlJRkdfwruznCeF1wJgWMhbMZr8YXlcyvLFUlnjEnKZb9JmtGET8IG30f4wt0l2N BAllSB+rt5RmuOPWDrySYH7H4b2f2Ib5NEmqnzOqPO2ofa9omTrX+Fog5JHf/1KkrS52 LCKhES7t78i6xCHdw0emaHghZ9dcX9sm77HA7R90VOCTXDuhPK2vq9NSrYxss/iu6xAs Q7FqNz1s329WPgpW6aNBAdVxjTJmf397Y99Rw7wkNWOlOakAn1HKiCKeCSP3Ji+Vd2aN pZFOHwl0GDZPHm7qdVi88Iqle9b5u5pPaTpPiNFMqtnSerN0vyRzNsjprk1cdVc2G1pB fTWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=6pXg3gg/TavSUSB3rOtDSHOzPZrtZd8c4za/VtNv2BY=; b=HhfmakkdBbVnNGbfrNsHKuU3Pm2IqID9wlyOASRp6JfuWItAql97YrtNDJ/QCjIIB1 6ZxZE95EJZQLcJvE0kv0l8nc/o0g2VBW8vfwtmZhb1uHgd57Pb7TKIbD5IOTyfVGx8dM 2sP8IcOSZPdUcYvMtyOCsPbp2zdXHxP45V2Wb+ZA2ISJGLiSMvNmizIv9QxQs83LZGkT JJA2H5/n5n/iiBOkuil6Zwm/pt3wjcvfLY8WbrWmupGtId4w2EtGGM5QQQubGDw82bRa 0c9L7ZQGRHv+nYi71JSYfM1/xz4x6Tnzz4GpCfBm3daGeHLu0O/pM8N3Zoiw+Jiq6HM4 PUOw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s18si5113600pgd.65.2018.03.16.08.38.49; Fri, 16 Mar 2018 08:39:03 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934426AbeCPPhV (ORCPT + 99 others); Fri, 16 Mar 2018 11:37:21 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40980 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934414AbeCPPhR (ORCPT ); Fri, 16 Mar 2018 11:37:17 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 99358123D; Fri, 16 Mar 2018 15:37:16 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Limin Zhu , Xinming Hu , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 077/109] mwifiex: cfg80211: do not change virtual interface during scan processing Date: Fri, 16 Mar 2018 16:23:46 +0100 Message-Id: <20180316152334.161595342@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152329.844663293@linuxfoundation.org> References: <20180316152329.844663293@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Limin Zhu [ Upstream commit c61cfe49f0f0f0d1f8b56d0b045838d597e8c3a3 ] (1) Change virtual interface operation in cfg80211 process reset and reinitilize private data structure. (2) Scan result event processed in main process will dereference private data structure concurrently, ocassionly crash the kernel. The cornel case could be trigger by below steps: (1) wpa_cli mlan0 scan (2) ./hostapd mlan0.conf Cfg80211 asynchronous scan procedure is not all the time operated under rtnl lock, here we add the protect to serialize the cfg80211 scan and change_virtual interface operation. Signed-off-by: Limin Zhu Signed-off-by: Xinming Hu Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -1116,6 +1116,12 @@ mwifiex_cfg80211_change_virtual_intf(str struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); enum nl80211_iftype curr_iftype = dev->ieee80211_ptr->iftype; + if (priv->scan_request) { + mwifiex_dbg(priv->adapter, ERROR, + "change virtual interface: scan in process\n"); + return -EBUSY; + } + switch (curr_iftype) { case NL80211_IFTYPE_ADHOC: switch (type) {