Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3558105pxb; Mon, 24 Jan 2022 12:10:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJx+us8gsWUtj+NrRl0K89D0LzmLILpYBZniPTL2el7tm05h8rIEoXufiqSprME3Z+/IyMk+ X-Received: by 2002:a63:451b:: with SMTP id s27mr12961632pga.39.1643055056233; Mon, 24 Jan 2022 12:10:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055056; cv=none; d=google.com; s=arc-20160816; b=YCcHMOtdmUbyHDXlmU31TMNtQ5shSCzt4nF3iYKLtbXT/ZsnmDuiXyFaRKFXWdGRPW 3ITZNb7v1IA3rgQjv8Ees6ju1CeNfCV/o3dJdqQ3SUOuFZD2yV8HQFgXrSwK2NDJR9oX P3k4FwNFeNpMZduudQcWoM4RKuct9G9br7nsDZ730zOxwaXcSEIxAqB/6lm9Rf4i1OeL SBQDy8n00ZHsitu03MCaIIGzuqKjSkIMkioMP7d+Vk59PnPa3/5BcBdp3MOtHd5Mk2P2 H8xibwC7KL2Pk8VWHtMZFpVIJZs2osp0+kT21JyxLKLNyeKjstgCKqDYEkPYJKmoZJFj X9FA== 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=JmH2cOPUm2e3yxPw5J2MJte1p/uFPayvUMQi2Wh5WCA=; b=xENaWc2qxkubYUP5evfo3N9HdH7Gc/sLpEPEFW1O0vTgyOMp0c2u7coJ5e3zI14uQ8 zT6VJEZNZTqkLm73mDsWD5TGa9EinEk/fSYXzC00Mkx6H0QstgiLIYp5DJ1XW1tWDeVZ cZGg6tyNp8Jxvk2f9wYgbYWhIC2UhFpqfbUAfHZNYRmvPOq6hg+5tOnQTTuTFJa7HXLP eBdvXyzDVFWDgtcyDeBF4YyKyVKJFr7UFPC+3/2UNWmLr/4J7vhTPHYRclB7zbQKT0tn 6cmW/wWhjZtjZYd1AbPtWpFBzpZSfUzQmyfJPETGZYULjCNqz+uB7BdU5Vz4U6rSRZlp oxZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="kqU/+ORP"; 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 x4si13246066plr.372.2022.01.24.12.10.43; Mon, 24 Jan 2022 12:10:56 -0800 (PST) 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="kqU/+ORP"; 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 S1345519AbiAXTMz (ORCPT + 99 others); Mon, 24 Jan 2022 14:12:55 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34980 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345897AbiAXTEn (ORCPT ); Mon, 24 Jan 2022 14:04:43 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ACD0460B88; Mon, 24 Jan 2022 19:04:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73926C340E5; Mon, 24 Jan 2022 19:04:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051082; bh=DNwXRQqJ2zdm78xxZBfZY5HB4Qqc18c8IshS3hzlm+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kqU/+ORPfz6FGfshyo0SEFZsw2a2ZKaXyLZweF5BInvcuq9Ayf3v6vNPEkR/yFN10 oQvbBMbLVgE5TQKFsuslYRnQ0jkR0GjBxFCODWiUU4Mzew41fcOmOh0KWyZLMeIOd4 iH1LhG4Apo8inFGvr9abflzrMEzod7TkY+Vn4h4k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tasos Sahanidis , Denis Efremov , Jens Axboe , Sasha Levin Subject: [PATCH 4.14 049/186] floppy: Fix hang in watchdog when disk is ejected Date: Mon, 24 Jan 2022 19:42:04 +0100 Message-Id: <20220124183938.707913060@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183937.101330125@linuxfoundation.org> References: <20220124183937.101330125@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: Tasos Sahanidis [ Upstream commit fb48febce7e30baed94dd791e19521abd2c3fd83 ] When the watchdog detects a disk change, it calls cancel_activity(), which in turn tries to cancel the fd_timer delayed work. In the above scenario, fd_timer_fn is set to fd_watchdog(), meaning it is trying to cancel its own work. This results in a hang as cancel_delayed_work_sync() is waiting for the watchdog (itself) to return, which never happens. This can be reproduced relatively consistently by attempting to read a broken floppy, and ejecting it while IO is being attempted and retried. To resolve this, this patch calls cancel_delayed_work() instead, which cancels the work without waiting for the watchdog to return and finish. Before this regression was introduced, the code in this section used del_timer(), and not del_timer_sync() to delete the watchdog timer. Link: https://lore.kernel.org/r/399e486c-6540-db27-76aa-7a271b061f76@tasossah.com Fixes: 070ad7e793dc ("floppy: convert to delayed work and single-thread wq") Signed-off-by: Tasos Sahanidis Signed-off-by: Denis Efremov Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/block/floppy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index cbf74731cfce6..b6c99cf1ce745 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -994,7 +994,7 @@ static DECLARE_DELAYED_WORK(fd_timer, fd_timer_workfn); static void cancel_activity(void) { do_floppy = NULL; - cancel_delayed_work_sync(&fd_timer); + cancel_delayed_work(&fd_timer); cancel_work_sync(&floppy_work); } -- 2.34.1