Received: by 10.223.185.116 with SMTP id b49csp2259864wrg; Thu, 15 Feb 2018 08:55:08 -0800 (PST) X-Google-Smtp-Source: AH8x22689Y8/QFnWC+VaguTuFDu+2DRSxdZPbfRRUi38jhombaoinWNKOWYWyZ/ivXYDK0HsPkbd X-Received: by 2002:a17:902:523:: with SMTP id 32-v6mr3083370plf.145.1518713708465; Thu, 15 Feb 2018 08:55:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518713708; cv=none; d=google.com; s=arc-20160816; b=HjOXuEAcnkLlqnce+T0fWlFaYNIHGBJt9ACWkvwDPQrc0N6Nb3xo/KnrWf4mnjSaHe jn6aQjbx2vp2KcNu5dY1XwvYF/sPaeIC0dAz5eOlontlgQT8NT6aqM27QGo1knVhcFUB Mvz8EgFvmIDl4cb0Kdk7E03kWpiOVQQPI9ztZURxYMoj23vLrts7K9KiPx6J+NLdRRJN gBajhXOztWX1NZujTUFMHRayHki6Wz6TwNoFa+dktJXIU80bO5D96YKGamzqDai8q/WU TFYdguns1Ex49e34RUJ7o/V0mi7tKR7bfd+f/+bRT5ZRHLzfdeXhqczH9X+oTjx1Qe3h KoWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=KWAt648QBbR3zieAPJlGJNp7QzjQcQCxyoP25UO47sA=; b=bNWfAkBfX7Uq9YYU9CALziKdp32halAKjyJf3aiNRtXazz9kp3JDFQFssCi5ujnnRP 16gjshfemSRcnm5h0qW+Il4zpKd+ePsf8CE+qn3BhlkF/32h+Xk4r+F4HdSiAIjpQgqE ruriGi/WG2G2EgH5MuxKJA2AYRbZ7b0EHfqr1px3FaNOwSudJ/iGqC3iZAAce4XH8QQ4 aKB4GfIDPGxEiW4IsafYq3+dPVN4Kls4Qzl/dH/Utx3Veikqcg4O4Pqi7e8+sVa4oU0L eHt0qCTk4+euFdbcAbzq00mpemh08wSuGfxHpXkWjHYXHqXvdwoQgTq1MF9XOgprLD9v DMAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e5-v6si3346321plb.566.2018.02.15.08.54.53; Thu, 15 Feb 2018 08:55:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423671AbeBOPkL (ORCPT + 99 others); Thu, 15 Feb 2018 10:40:11 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:60000 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423659AbeBOPkH (ORCPT ); Thu, 15 Feb 2018 10:40:07 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1FC6C1146; Thu, 15 Feb 2018 15:40:06 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rasmus Villemoes , Guenter Roeck , Wim Van Sebroeck Subject: [PATCH 4.15 008/202] watchdog: gpio_wdt: set WDOG_HW_RUNNING in gpio_wdt_stop Date: Thu, 15 Feb 2018 16:15:08 +0100 Message-Id: <20180215151713.242766975@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rasmus Villemoes commit bc137dfdbec27c0ec5731a89002daded4a4aa1ea upstream. The first patch above (https://patchwork.kernel.org/patch/9970181/) makes the oops go away, but it just papers over the problem. The real problem is that the watchdog core clears WDOG_HW_RUNNING in watchdog_stop, and the gpio driver fails to set it in its stop function when it doesn't actually stop it. This means that the core doesn't know that it now has responsibility for petting the device, in turn causing the device to reset the system (I hadn't noticed this because the board I'm working on has that reset logic disabled). How about this (other drivers may of course have the same problem, I haven't checked). One might say that ->stop should return an error when the device can't be stopped, but OTOH this brings parity between a device without a ->stop method and a GPIO wd that has always-running set. IOW, I think ->stop should only return an error when an actual attempt to stop the hardware failed. From: Rasmus Villemoes The watchdog framework clears WDOG_HW_RUNNING before calling ->stop. If the driver is unable to stop the device, it is supposed to set that bit again so that the watchdog core takes care of sending heart-beats while the device is not open from user-space. Update the gpio_wdt driver to honour that contract (and get rid of the redundant clearing of WDOG_HW_RUNNING). Fixes: 3c10bbde10 ("watchdog: core: Clear WDOG_HW_RUNNING before calling the stop function") Signed-off-by: Rasmus Villemoes Reviewed-by: Guenter Roeck Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Greg Kroah-Hartman --- drivers/watchdog/gpio_wdt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/watchdog/gpio_wdt.c +++ b/drivers/watchdog/gpio_wdt.c @@ -80,7 +80,8 @@ static int gpio_wdt_stop(struct watchdog if (!priv->always_running) { gpio_wdt_disable(priv); - clear_bit(WDOG_HW_RUNNING, &wdd->status); + } else { + set_bit(WDOG_HW_RUNNING, &wdd->status); } return 0;