From patchwork Tue Jan 23 09:03:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10179831 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7D569601D5 for ; Tue, 23 Jan 2018 09:03:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F27B2857F for ; Tue, 23 Jan 2018 09:03:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61B4A285E8; Tue, 23 Jan 2018 09:03:42 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05D922857F for ; Tue, 23 Jan 2018 09:03:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751125AbeAWJDj (ORCPT ); Tue, 23 Jan 2018 04:03:39 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:42543 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750946AbeAWJDi (ORCPT ); Tue, 23 Jan 2018 04:03:38 -0500 Received: by mail-wm0-f68.google.com with SMTP id r71so307283wmd.1 for ; Tue, 23 Jan 2018 01:03:37 -0800 (PST) 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:in-reply-to :references; bh=kK7kHZ7dBsmIzoMZFJoAN2AbLYmE8gOBQrvpURrXOaQ=; b=h3GdO2fzw3QWCWvaMYfUeKMmp2/W3nIWvEt6I3/OoqZtDPPOh9e0Qm6KOpo5cca/st dTuu7hX4m0RQiyvcAKYiOL/zAbFMFSZVc3HCZ7rrJGxnEI5nt24z4TsZjCMszwdYn8gW PO6pqSxSqsXjIlxNXriHHwU+48/IZMDqPqdvrLttMf3RnyvrsRV2Y1th48zv5kdvBiVW ok3N3vY44++hw/CpwVjhKP1ZmomA6PGq+tn/K1uJG3ExUJxIhJamy5mDaQiFZi+v31BO WXqqyBI68N9r2ubpb3U3HOui8gIx6haVN7nQ8NHs+doI9yJqlgHuUlmKt8gstze5ocZ8 G3nw== X-Gm-Message-State: AKwxytcZwmWaKUU5TGbWVsJo5QUIwCKimJg/3u3B8iei1pYmni1uMh9Z qnlh7UhCtAP49lTJNqYmMIDdPw== X-Google-Smtp-Source: AH8x2265ttH7VZBlVVABb3JU0G72g6YgKG8ewshUzyexxfh0IZNSn2tXbeHFQwVXvWgfffGN999VdQ== X-Received: by 10.28.194.137 with SMTP id s131mr1389757wmf.3.1516698216875; Tue, 23 Jan 2018 01:03:36 -0800 (PST) Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id d8sm4188249wra.22.2018.01.23.01.03.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2018 01:03:36 -0800 (PST) From: Lorenzo Bianconi To: nbd@nbd.name Cc: kvalo@codeaurora.org, linux-wireless@vger.kernel.org Subject: [PATCH v2] mt76x2: init: disable all pending tasklets during device removal Date: Tue, 23 Jan 2018 10:03:24 +0100 Message-Id: <612e527f5358f4d7d465f21fc72b5b649dce5f40.1516697336.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is a possible race in mt76x2_stop_hardware() since pre_tbtt and dfs tasklets could run during driver cleanup. Fix it disabling all pending tasklets during device removal Signed-off-by: Lorenzo Bianconi Acked-by: Felix Fietkau --- Changes since v1: - add proper commit message - squash patch 1/2 and 2/2 --- drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c index 9f20a308ff76..7b4851481dd6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c @@ -614,6 +614,8 @@ void mt76x2_stop_hardware(struct mt76x2_dev *dev) void mt76x2_cleanup(struct mt76x2_dev *dev) { + tasklet_disable(&dev->dfs_pd.dfs_tasklet); + tasklet_disable(&dev->pre_tbtt_tasklet); mt76x2_stop_hardware(dev); mt76x2_dma_cleanup(dev); mt76x2_mcu_cleanup(dev);