Received: by 10.223.185.116 with SMTP id b49csp2588091wrg; Thu, 15 Feb 2018 14:11:07 -0800 (PST) X-Google-Smtp-Source: AH8x226xYBaoJKpTG+AxK/iDuFWd1IyII1hhyVDxuy8W2yvpoUiBAVbJssPrMNxw9PhfjeR7ffss X-Received: by 2002:a17:902:a617:: with SMTP id u23-v6mr3815269plq.201.1518732667023; Thu, 15 Feb 2018 14:11:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518732666; cv=none; d=google.com; s=arc-20160816; b=eldqkqkiGo8wDaF7Yd7kqaMCwivECQIjZlA7T0BbcllxswQtVl+JjeOwlnbVE1usL/ FxMNZNqPTzlh2evrbKd9rSV33Of9fPWBZPWRHojlDrCD5u/KJHGn508y8ly8ZgiYOLCi K2G5J0sPsdDpxaA3QcQ97uF+pMpOL0+d8QSBSmURj7T8XQJRVMt4NfwZxuZsjplI55js HSe6slLOzBuMWjR1mDCW/shC97AWrbmTbwbA4saKNtdudCnSqh+Dg6D0tkqPCOT+rL1P xLhaHO+XuucUX8qYBiZABM1XpNERPKy5vqdboVpORXH+2q/X80i01pHMz1NEF2Yg7CCm zYjw== 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=2ugTumJ+zDIDv+Re3kg8TKmFkKujpEHmSabaYiV/1Uc=; b=DctqIA6IQcdF/5R0j3GDyExyJeYV7iCo3ruYWARGkHwA2lTTBbR9ZQyH3rl2kokv0s 6s1Znev4W57iF1wcAGSQ4X9u5B6SOIXb+vZTHlgegZ9YgkQ2SMnIKpNj2MeDGTERXmP5 1/vBZQrGijdAfSBgjv6JhAZmgMWDnyk4+ZTAbQ5a7FfQxFBaLyuFMsjZMb8XDOFgcm6A b+981ZFUrM+Y7NZrNe0F3tXFTl1H/3qZYaLDzn2Z6BcSLlU2u0HE4KOMWnurA+zNeKPN NRi7/FrhP7VEa0ALzjeeSQAOE+8fTYjKeb0HR4/6oxrN9xpaGLJbSSjSJ9YNdjachmeu ea0g== 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 l80si8291016pfb.178.2018.02.15.14.10.51; Thu, 15 Feb 2018 14:11:06 -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 S1164266AbeBOPap (ORCPT + 99 others); Thu, 15 Feb 2018 10:30:45 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:55174 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164255AbeBOPak (ORCPT ); Thu, 15 Feb 2018 10:30:40 -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 DB01710AC; Thu, 15 Feb 2018 15:30:39 +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.14 009/195] watchdog: gpio_wdt: set WDOG_HW_RUNNING in gpio_wdt_stop Date: Thu, 15 Feb 2018 16:15:00 +0100 Message-Id: <20180215151706.217608678@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151705.738773577@linuxfoundation.org> References: <20180215151705.738773577@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.14-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;