Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp713676pxv; Thu, 15 Jul 2021 14:12:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVu0P8mhd5ynUz7HCB9AliInh+pN0kUT0jYpbhtz3vkQM+HLabESaNz6wPxfIm0kiJN0e8 X-Received: by 2002:a05:6402:1103:: with SMTP id u3mr9893784edv.342.1626383575747; Thu, 15 Jul 2021 14:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626383575; cv=none; d=google.com; s=arc-20160816; b=Wm+Egon6fZfkFs4o3ucdFb5620ZBVs22w3Rw44zYL4PBJFK6wJ/knMcc63EWD/Mupq DkuhY+MDsweQ2uvw3FFr9grKAiiny7cLptrkseEi8PS7whEOmgm6beqSDJGMkjV27Faw XBPXGIZKPlUnmFhF7IB5xjBY6A8XK/NbfPVsSWZS1WZ2Er8tEL+9Cb6aEpPKAmyKxvS1 245NCB/I+ACo9y3DSgSfuJlGtm67/VNt9HW5rRc+aFTo+nmLfDQ4ifGGpMOIhZwU1Ki5 pBzbJSVRdrOn6ug4A3+ugQGuFHUSb4TpxIWi1mLWAECAje5FhA0bhVQ0QkDppp/qP0BC ONKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MdhoUGZ8Tj/av+Coi5VL54DlQS79TIr1VE06RVDq1HY=; b=euLQl3SrVC+JqxAHMn91ReMLP0HI54btFBKFb3PxdOJqIok7UpvevvRvOWJlUQtwCk RW4+PkQBkM3BH0PSvyUjumzqGpXLXPlUARM/+zielE8DriMgb5TJ5+yWCqvtcpSm2x2W ibN2AaXBZqElmLHGiEwMwg9dS6bstYag1r3TwY7xnbH27Oxe3+6PKnI2flAk3dnTKGAY yC+XIJ23xVLpbVssRfS6UGA58WxmhVGdikDKc0aNuwo1Th4A0pfLHRkcQzXTTngiKhxV ftPEyO1oeJ1ii9PQ+hvTzWHgBgdFuQ7r1ifC/2caTmyQDkOjYewEqgITXNZW7LjFoDOg 2vAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vKQG9fTc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si8935715edv.57.2021.07.15.14.12.32; Thu, 15 Jul 2021 14:12:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vKQG9fTc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344009AbhGOTZA (ORCPT + 99 others); Thu, 15 Jul 2021 15:25:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:45628 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242669AbhGOTIM (ORCPT ); Thu, 15 Jul 2021 15:08:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8BA11613DB; Thu, 15 Jul 2021 19:04:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375846; bh=9upz0cKdc/qYU4JjyOzTGWrs6l3cCYP97s9qfpHPtkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vKQG9fTcAxv/kUh//076ZFrj4DMlhYpIUeUbO0s/OdQzel4pmW+5TfEwmMMRdgLiA 4TnzM3wzeLNuTwBME5zIDh9n9ZE09FAe4hdPCf+DznRutbeVyapb5fNt8EPFM7GOVI sS9CuUxcxJriICdQIlqR/aNFOFrf3Y/QMVlQBA9g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Zou Wei , "David S. Miller" , Sasha Levin Subject: [PATCH 5.13 019/266] mISDN: fix possible use-after-free in HFC_cleanup() Date: Thu, 15 Jul 2021 20:36:14 +0200 Message-Id: <20210715182617.280276704@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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