Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4771076pxj; Wed, 12 May 2021 12:54:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbWt0E1ejHa3XHcnULHPbtHIGxCEEpBPHrUOUrwZ//sFu+npFSOXNi/PbZymnky9+Y2PbU X-Received: by 2002:a17:906:590a:: with SMTP id h10mr5273240ejq.540.1620849273519; Wed, 12 May 2021 12:54:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620849273; cv=none; d=google.com; s=arc-20160816; b=oc+reGsYP3tcVYeZHgbB2SbJjsocYS5V6M8ozfdusT9gu7Kh5nIIfWhrkvA/j5OsaE ThaKcHOY8K8nExEJx8XmyErp08KEQs0nJ058FUrMacnr7nh4/RyVfjUDYhST3GIKYz2A rwE/HFNIQuDBXUpPT+bMHU3mYnRfRApa5ddIbB6NeKMQOVVzS1N1FZ7vzwYKGQk+2DYI GbOkye7b7WBDy4HjwetFB1j4Zs5wD7pOfjKQ+IDUixIOdsOlY7fdfzVC0rv4Pb59Vkz1 +9ftyVjNzLpo7K+tuyiUq002TShK6yETQWZadhKVc7EnOf5r9OwJnZz7vK9JOd7V6MxZ HacA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=Iqm/kKc8UvAGY4mUdB/+Ch7W/4QIYQlonLscJfgNmuo=; b=DgkFvFISICEOFU4SD7HyM5LqR/K7k00apgoc5Uocenks0geHywbkeN0I2RmEkGSzfb nqyv9lUV72uhE8aGwOOgGPkfUClwKZBSMWk5IjuFl5sVTITU7Ohivms2SAphZqN205dD 6l7xIIywUZC9tr7V+uLf6xGsIFiWp5wUhtdoG1Z0o1Ae2UIETqp3l62/6QWyMvjrvkvH I6Q7WNh2JRrMeKvIBRv2JtVImzzuDzqVPAONMpUuWj2beIzSC3F+UrT6YQXT85bRBVBe jNIBaoe863uo52i38ZGlAVkRcncS85QfrJ8ZQatxt8aR1pmEsaW3OLJ5QOKTdjQd2Zgb am0A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q1si745702ejy.298.2021.05.12.12.53.01; Wed, 12 May 2021 12:54:33 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380838AbhELTco (ORCPT + 99 others); Wed, 12 May 2021 15:32:44 -0400 Received: from mleia.com ([178.79.152.223]:32924 "EHLO mail.mleia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346519AbhELRNt (ORCPT ); Wed, 12 May 2021 13:13:49 -0400 X-Greylist: delayed 488 seconds by postgrey-1.27 at vger.kernel.org; Wed, 12 May 2021 13:13:48 EDT Received: from mail.mleia.com (localhost [127.0.0.1]) by mail.mleia.com (Postfix) with ESMTP id 1E5D31264; Wed, 12 May 2021 17:04:28 +0000 (UTC) Subject: Re: [PATCH -next] watchdog: Fix possible use-after-free by calling del_timer_sync() To: Zou Wei , wim@linux-watchdog.org, linux@roeck-us.net Cc: linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <1620802676-19701-1-git-send-email-zou_wei@huawei.com> From: Vladimir Zapolskiy Message-ID: Date: Wed, 12 May 2021 20:04:27 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <1620802676-19701-1-git-send-email-zou_wei@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-49551924 X-CRM114-CacheID: sfid-20210512_170428_148887_70604D62 X-CRM114-Status: UNSURE ( 7.50 ) X-CRM114-Notice: Please train this message. Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/12/21 9:57 AM, Zou Wei wrote: > This driver'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 Acked-by: Vladimir Zapolskiy -- Best wishes, Vladimir