Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp712722pxv; Thu, 15 Jul 2021 14:11:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/9WlRkujy5ArYdXO9C9Csg45zzv8T5owYKFcedTzn8BRyIau6aRszQWcbvfifmHV6DAyg X-Received: by 2002:a05:6402:29a:: with SMTP id l26mr9751781edv.207.1626383478339; Thu, 15 Jul 2021 14:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626383478; cv=none; d=google.com; s=arc-20160816; b=LvEHNRFiHkqrv4iGLmTLjXTV6bH2Jy70NTgZjKvGT/w697kRKcpP+w1+SK/6Qd5oZY yMrcJPm9WAFDeY3YqGrKRZJS3oLel+5O6yO6eNq25eS99iLw1NcTEpsqGW4aj+0ge9kx GA6Ud3ERNXHngE+qoM4nE0YgY4wZnEhyNYJJ9HWwFpv4xA5ZkAzyGzrdxlCuAkTZRRCW Udh9IYm3824jmYwI0HDC+0C2Z2aGNQGbQmagTvwO511Qdo2Guge++aTYpDdSu8Y44E0S /qwVfZM75RgA/RtHQsgKzArz00Dkc38n3qQ1b9Yd/Xkbk/1g9gxdLp8B4cG245M21wjT nceQ== 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=0H0n9dR0UOa0JX6OdvwCLboucc8owSIUDh8cGyXwQFs=; b=htquLAohgDnGndFkzBN4Nw2d21bxSU3Mom60En9D0ti0gSub54sC4y+q/3I/0dmk0l 8oLQl9LY+HHKJkn1AVcxHWEykc+H0kr8+0XzRQ/EOBGlNdBsCq23m7IkigB1XQjPnjb7 iDC9LqH/YbmDj2bW3GbDfd3/0NgNCla5Vh4LwREd40JXziD5djcFT0yXlak3Oagufq0h +NzHvkOrRiiBP/hHRjhYmn+JqdFszXGBRkCrU8UCHsILEMaearKufUP1HbrGG5ps00+J Ke1zfBqQipAwWesrtFHvvaHTUSq00JKdFZIG9hQufnxFAGdqIdKHvCSsWo2xplpIqppr LFTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q3Xix7tH; 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.10.55; Thu, 15 Jul 2021 14:11:18 -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=Q3Xix7tH; 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 S1343968AbhGOTY7 (ORCPT + 99 others); Thu, 15 Jul 2021 15:24:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:46538 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242556AbhGOTH5 (ORCPT ); Thu, 15 Jul 2021 15:07:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 342BC613D1; Thu, 15 Jul 2021 19:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375843; bh=aSoqkgLMMkj0nH15Wv3eicMFw1uKtGpu3lgUv1xvyjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q3Xix7tH2kog63oNb2ahEO7JoMwXXRZgtTtMIGpVcUQyFNrqyT1691gyy8+5wnnYi 2L0CvIst7KP147kGnnIn4P08izcu45QTrllThVGF4CT8CSmhTUDLTRKm7Fq5kjk6ME Cu4hc1xizL62q3hxV16Ds2yCf2e+xEvtmtGO1dtQ= 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 018/266] atm: iphase: fix possible use-after-free in ia_module_exit() Date: Thu, 15 Jul 2021 20:36:13 +0200 Message-Id: <20210715182617.081781922@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 1c72e6ab66b9598cac741ed397438a52065a8f1f ] 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/atm/iphase.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c index 933e3ff2ee8d..3f2ebfb06afd 100644 --- a/drivers/atm/iphase.c +++ b/drivers/atm/iphase.c @@ -3279,7 +3279,7 @@ static void __exit ia_module_exit(void) { pci_unregister_driver(&ia_driver); - del_timer(&ia_timer); + del_timer_sync(&ia_timer); } module_init(ia_module_init); -- 2.30.2