From patchwork Thu Nov 8 00:40:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 10673303 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 3023315A6 for ; Thu, 8 Nov 2018 00:41:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E1F12D409 for ; Thu, 8 Nov 2018 00:41:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12A572D47B; Thu, 8 Nov 2018 00:41:22 +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=-3.4 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW 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 95E8A2D45A for ; Thu, 8 Nov 2018 00:41:21 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=IoKUVuJSuishGwQxYX9fvQ6JCBLoSWW6NvhtBbWjpcY=; b=R1eShH8lPmxPdF AbZKwhgwNtCoLBjd9N9pptBqLiN7xpzMCLPD/Jg8EG/fHfnzt5EDnr1E5XGDypaWkBLdLxkOQ0/Xr FtA1o1+DaAgtRDEf8M0DmJDigVHz9LLHhuUNXFf/Bhk8DUSfT0A1PgJwixxYoNhX/YLa6TWbYJty1 X8cYnxTLERRxFkTs6qgzAHCI42vgiRXyrapXfBuSEs3i6bPJCbtCRbug7aENGQDve6FMpnn7RdF6C Rurn0Lp3dxzjleE2zDvc8B6YKYiKyg6KyufyPKRyB7XQtIDL/rN8U0Jogf0MY+9h/qIqlHPh5NHQh qq/xT/WRD3cDvQ5eZ2SA==; 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 1gKYNr-0004ka-T4; Thu, 08 Nov 2018 00:41:19 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKYNo-0004jm-Sd for ath10k@lists.infradead.org; Thu, 08 Nov 2018 00:41:18 +0000 Received: by mail-pl1-x642.google.com with SMTP id w22-v6so5335920plk.0 for ; Wed, 07 Nov 2018 16:41:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=HiC88We3WtpUAK5UV/yHi4vzd4IqfUz6PzgP46+jcjE=; b=ZuZ7hp1EkYQNcLT34WLFWbsiCign2BgHoy5e064xMbYbuoekBFt/PVP6DReHUq+L63 wI/rmwEX7ecROgoCb3kPQ5RNoYj3pV1z7IC7kwffdTkwkbLYNSRU4JS2SlnqL49tCSEf 81x/CZleQbgKPqsXXq0wglyoyA5MhexZOORu8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=HiC88We3WtpUAK5UV/yHi4vzd4IqfUz6PzgP46+jcjE=; b=bSG2ggI8dhr3uxfo3Zwg4LkmgepGaeprXJr3j0DwMAi7cXMXHf47nyi/Ekv8i9aFJt O52oE7nudz9mtTmOQNHZDfQb/l80+7uT5PIuSIaQMO3Tn3iw4mmOR/9Ezv+ao8T+CJvM nDWVwkHIMdhESRM1I0/UHyApH7OhfSAY8MuT4ejFdIxw9toZfirpmOYtu6ymP8ACnnn7 QZE+RuKDJlRaBgEZJECS6taOPtktyYgoDzPPUgtOJPwXb0ulgaYRp3rhkSWaAC+B7u9B WyO0Xeo+cz0jonX//i/SD/0kHtmYEDFpOX9DZKVFB7ZfHN8jds5ULvqF6q3VXfkDkhXy 0iqA== X-Gm-Message-State: AGRZ1gINiHa5M4NPx55H8pVpOpCBgT2SXzAIKuW9kJL8Jvcx8SWyfLJ2 munfswQBvxCYKkRdo9RNElmzTW1c+6U= X-Google-Smtp-Source: AJdET5fDSeW+md94UsjROkNazMSwESUTRyifgc8hzYp7ckSLaTutptA9SeBZt+h+vXkji/aqr3yuCg== X-Received: by 2002:a17:902:4025:: with SMTP id b34-v6mr2519684pld.318.1541637665599; Wed, 07 Nov 2018 16:41:05 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:1:299d:6b87:5478:d28a]) by smtp.gmail.com with ESMTPSA id x63-v6sm2244685pfk.14.2018.11.07.16.41.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Nov 2018 16:41:04 -0800 (PST) From: Brian Norris To: ath10k@lists.infradead.org Subject: [PATCH 4.20] ath10k: don't assume 'vif' is non-NULL in flush() Date: Wed, 7 Nov 2018 16:40:35 -0800 Message-Id: <20181108004035.136050-1-briannorris@chromium.org> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181107_164116_926220_4B9B2B12 X-CRM114-Status: GOOD ( 12.50 ) 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: Grant Grundler , Brian Norris , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Wen Gong Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP mac80211 may call us with vif == NULL, if the station is not currently active (e.g., not associated). It is trivially easy to reproduce a crash by suspending the system when not connected to an AP: [ 65.533934] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 ... [ 65.574521] pc : ath10k_flush+0x30/0xd0 [ath10k_core] [ 65.574538] lr : __ieee80211_flush_queues+0x180/0x244 [mac80211] [ 65.599680] Process kworker/u12:1 (pid: 57, stack limit = 0x(____ptrval____)) [ 65.599682] Call trace: [ 65.599695] ath10k_flush+0x30/0xd0 [ath10k_core] [ 65.642064] __ieee80211_flush_queues+0x180/0x244 [mac80211] [ 65.642079] ieee80211_flush_queues+0x34/0x40 [mac80211] [ 65.642095] __ieee80211_suspend+0xfc/0x47c [mac80211] [ 65.658611] ieee80211_suspend+0x30/0x3c [mac80211] [ 65.658627] wiphy_suspend+0x15c/0x3a8 [cfg80211] [ 65.672810] dpm_run_callback+0xf0/0x1f0 [ 65.672814] __device_suspend+0x3ac/0x4f8 [ 65.672819] async_suspend+0x34/0xbc [ 65.684096] async_run_entry_fn+0x54/0x104 [ 65.684099] worker_thread+0x4cc/0x72c [ 65.684102] kthread+0x134/0x13c [ 65.684105] ret_from_fork+0x10/0x18 Fixes: 9de4162f0999 ("ath10k: add peer flush in ath10k_flush for STATION") Signed-off-by: Brian Norris --- drivers/net/wireless/ath/ath10k/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index a1c2801ded10..7e49342bae38 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -6867,7 +6867,7 @@ static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u32 bitmap; if (drop) { - if (vif->type == NL80211_IFTYPE_STATION) { + if (vif && vif->type == NL80211_IFTYPE_STATION) { bitmap = ~(1 << WMI_MGMT_TID); list_for_each_entry(arvif, &ar->arvifs, list) { if (arvif->vdev_type == WMI_VDEV_TYPE_STA)