From mboxrd@z Thu Jan 1 00:00:00 1970 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=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 8BB92C11F97 for ; Tue, 6 Jul 2021 11:34:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8237A608FC for ; Tue, 6 Jul 2021 11:34:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231528AbhGFLgZ (ORCPT ); Tue, 6 Jul 2021 07:36:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:42666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234953AbhGFLbS (ORCPT ); Tue, 6 Jul 2021 07:31:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 619D461CA2; Tue, 6 Jul 2021 11:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625570543; bh=9upz0cKdc/qYU4JjyOzTGWrs6l3cCYP97s9qfpHPtkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bf2CM+qKcAAdkY8qYyBtqznlAD8sm9qbI6Qd0DA0UCE7U0H2bdbSMq5a3uguaVKtH xi7l6CgoeB+nsZ9TQsxL9iNjAThOwMr/GrL6NRq0GVpe+ctRrXWmFOKN7aH3ByRqfV uMhUk8O1z/alDcNGpBdlycf3N2V3xXHEZL2+qTkPaWq4fFQCmIgls26Yr3GjJie/9w 4ZM//K4i6Ye2Bcpj2jtEQCshHh1Q46WO4dnO3TIcRAxUXeBoZv68VYpSvZbWqnZWny DWQdSXweUXu9xVnnBt1PuKASySXbN71MsK87dEodidDZbMeC+4kuXMElPdW09rF0UG 8oE8ShCvoja1g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zou Wei , Hulk Robot , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 014/137] mISDN: fix possible use-after-free in HFC_cleanup() Date: Tue, 6 Jul 2021 07:20:00 -0400 Message-Id: <20210706112203.2062605-14-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210706112203.2062605-1-sashal@kernel.org> References: <20210706112203.2062605-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Zou Wei [ Upstream commit 009fc857c5f6fda81f2f7dd851b2d54193a8e733 ] This module's remove path calls del_timer(). However, that function does not wait until the timer handler finishes. This means that the timer handler may still be running after the driver's remove function has finished, which would result in a use-after-free. Fix by calling del_timer_sync(), which makes sure the timer handler has finished, and unable to re-schedule itself. Reported-by: Hulk Robot Signed-off-by: Zou Wei Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/isdn/hardware/mISDN/hfcpci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c index 56bd2e9db6ed..e501cb03f211 100644 --- a/drivers/isdn/hardware/mISDN/hfcpci.c +++ b/drivers/isdn/hardware/mISDN/hfcpci.c @@ -2342,7 +2342,7 @@ static void __exit HFC_cleanup(void) { if (timer_pending(&hfc_tl)) - del_timer(&hfc_tl); + del_timer_sync(&hfc_tl); pci_unregister_driver(&hfc_driver); } -- 2.30.2