From patchwork Mon Oct 26 04:18:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 11855667 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,MIME_HEADER_CTYPE_ONLY,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4491AC388F9 for ; Mon, 26 Oct 2020 04:18:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CBEA120773 for ; Mon, 26 Oct 2020 04:18:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="NUlDznmz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1420915AbgJZESe (ORCPT ); Mon, 26 Oct 2020 00:18:34 -0400 Received: from mail-pj1-f68.google.com ([209.85.216.68]:51419 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1420823AbgJZESd (ORCPT ); Mon, 26 Oct 2020 00:18:33 -0400 Received: by mail-pj1-f68.google.com with SMTP id a17so2485106pju.1 for ; Sun, 25 Oct 2020 21:18:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ia7W+Te5tnERYre+fEhaGeEB9dh9a5vlTs1WxqxQS2Y=; b=NUlDznmz4Moulk1baLU8jYNlpNXicbAEBrlu7Y0dc/RR0ON1mtCGLWHTbv+eQO+Y2h +FoSEu1lX7JVGn4ygjfkXa6fsyq4I045zcVUpk0nQd/Y2C3qlxkfaDIjiemYbUk/pwF1 RYY9mBRZtqchYunH616tTM43V+nD5GbocrTbs= 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=Ia7W+Te5tnERYre+fEhaGeEB9dh9a5vlTs1WxqxQS2Y=; b=ofAeFG5OmQ5X1/lpOBCmPmvUGe+3v4LwgrcCCZYOrBF80ii7I8VekAlY9ozQzC5ddZ CjTIWmrby0tYCd59vziUEC8IRVxScX2b81S7FFGgzevwiL3/XXBpRW5xViL0Ir0ebA94 47HjYAbIIZW127sv7rUjsql/wBaS9EeL+IIeU8oByLbaMZ43yhDWZPZQu8D5VpZiDG8P PPxHZQkegrnk3/Zk8e018WN7rW9X1qcbhkZUrQVWJM0HzM+tPxRNONrc5DhRjhf7Yt0p 0uoL2FlSqFsdXX8QAtan7K+jdfOJ/O4bqrDxm0gZOul6WONIRnOhiRj4wChIw7eRF/ZF TCoA== X-Gm-Message-State: AOAM531296FmSJrbh6jaF3i7Cj66O1Bf5aQsIkFXvOzi0olg9/BZBB3N ZPevs9etfexvbk2MeXMtNm/QiYATbbJxyg== X-Google-Smtp-Source: ABdhPJx4jHybt57I3LuxIJOmma9Fmg1z+nbvmWZSaNKS4Q9QzHow+IUsPqwOLSG4EMxcITJqJpD/uw== X-Received: by 2002:a17:90a:8b0f:: with SMTP id y15mr5206198pjn.194.1603685912169; Sun, 25 Oct 2020 21:18:32 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id 10sm11505835pjt.50.2020.10.25.21.18.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Oct 2020 21:18:31 -0700 (PDT) From: Michael Chan To: kuba@kernel.org Cc: netdev@vger.kernel.org, gospo@broadcom.com, Vasundhara Volam Subject: [PATCH net 1/5] bnxt_en: Fix regression in workqueue cleanup logic in bnxt_remove_one(). Date: Mon, 26 Oct 2020 00:18:17 -0400 Message-Id: <1603685901-17917-2-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1603685901-17917-1-git-send-email-michael.chan@broadcom.com> References: <1603685901-17917-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Vasundhara Volam A recent patch has moved the workqueue cleanup logic before calling unregister_netdev() in bnxt_remove_one(). This caused a regression because the workqueue can be restarted if the device is still open. Workqueue cleanup must be done after unregister_netdev(). The workqueue will not restart itself after the device is closed. Call bnxt_cancel_sp_work() after unregister_netdev() and call bnxt_dl_fw_reporters_destroy() after that. This fixes the regession and the original NULL ptr dereference issue. Fixes: b16939b59cc0 ("bnxt_en: Fix NULL ptr dereference crash in bnxt_fw_reset_task()") Signed-off-by: Vasundhara Volam Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index fa147865e33f..e4e5ea080391 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -12108,15 +12108,16 @@ static void bnxt_remove_one(struct pci_dev *pdev) if (BNXT_PF(bp)) bnxt_sriov_disable(bp); + if (BNXT_PF(bp)) + devlink_port_type_clear(&bp->dl_port); + pci_disable_pcie_error_reporting(pdev); + unregister_netdev(dev); clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state); + /* Flush any pending tasks */ bnxt_cancel_sp_work(bp); bp->sp_event = 0; bnxt_dl_fw_reporters_destroy(bp, true); - if (BNXT_PF(bp)) - devlink_port_type_clear(&bp->dl_port); - pci_disable_pcie_error_reporting(pdev); - unregister_netdev(dev); bnxt_dl_unregister(bp); bnxt_shutdown_tc(bp);