Received: by 10.223.185.116 with SMTP id b49csp5965244wrg; Wed, 7 Mar 2018 22:48:51 -0800 (PST) X-Google-Smtp-Source: AG47ELs4JkbWlfBasWgfz4OzC6INCOXJFhgb3I3CAsdaoTqS77HkKLv8wTg5lm9+rI0jWKYzUFDq X-Received: by 10.98.133.193 with SMTP id m62mr25239244pfk.74.1520491731689; Wed, 07 Mar 2018 22:48:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520491731; cv=none; d=google.com; s=arc-20160816; b=fWLgcxFQZy0E2NupzONhG0cjCoYpHLicV/TxOg6b2UzpoD0GtzR5/GQU2xJd7WNkgv pxWtxiwqOM4o0hkHFjWjkyj795bpuRzkgZ7ZruTR/K9l5ynZO2HFcnnmOcU3fikVfHId slLItSqoFtN/D77u7DGMltiKo9AIeZ60ikGjrZVyam2uLUrewzUR6emgWlQyfZlgN0KW n2ChN90Raf9cIRqRkfYQkr5ATv7P6mp3L/k0Wpw8of9+aVDctdLvHv6vvQONAsw0WWqc IPiKUKxJzUPeaxBXdB+eoVG4Kg+otG+JgE9m4V9TbJ4LhyAonnX1CUPWCrvGPXa09TSe zEQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=/ZzQOgA7qO6mUkRORquUSqmlFiKZkqekmixb6lFJQyQ=; b=jmzpToiZNH1vs1yA7BnRddngIZnOtcxcHZq+iGB81crAP6T3if8EgRmE0mTefNLJTg bV+J9/u0hyvIXDrWbdeIahhgOS9LOtMA9j3kch+vhzOB5U8v+gkNk0xQ9rtAaOHU5sza kzSdO5rlorviI2fKv34jGxDxMe1IEvavoIQ1NfD0m0HDj5vRtxx16tvSFI4B0YOlYdMg CQjT5WvMo8OjB0E/L15PlWGAUWmkhAaQVn5CTAz9cU80ZjBah/JAMUylV2tuJWRfXyHs xuXPHM84Q4l+fYCNDcW0ybHy+0UDJeiCmwldRogbxVcHTFZaGscurXgTmNOz4CLCX4Zl QCHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=lTjUN9yT; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q16si12671526pgc.610.2018.03.07.22.48.37; Wed, 07 Mar 2018 22:48:51 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=lTjUN9yT; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965279AbeCHGrR (ORCPT + 99 others); Thu, 8 Mar 2018 01:47:17 -0500 Received: from mail-by2nam03on0101.outbound.protection.outlook.com ([104.47.42.101]:17968 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965050AbeCHE6W (ORCPT ); Wed, 7 Mar 2018 23:58:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=/ZzQOgA7qO6mUkRORquUSqmlFiKZkqekmixb6lFJQyQ=; b=lTjUN9yTGEK3MjoHApHE+J+DilmroVdNK/9zeQKXlJzhC1jTW78PcbRuKbshkPqErECjzSXOfcowMYRMcfkKc0RAzaNgGRzslQgv6gCJ8sfZ4LQ7wylbgHbFbPeiiLSdoCIskyoyxIAy/Xf2yf0OxJ+qpuIl1ZSr1GuZtaANXHw= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0808.namprd21.prod.outlook.com (10.167.110.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.1; Thu, 8 Mar 2018 04:58:15 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446%2]) with mapi id 15.20.0588.008; Thu, 8 Mar 2018 04:58:15 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Guenter Roeck , Sebastian Reichel , Wim Van Sebroeck , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 24/67] watchdog: Fix kref imbalance seen if handle_boot_enabled=0 Thread-Topic: [PATCH AUTOSEL for 4.14 24/67] watchdog: Fix kref imbalance seen if handle_boot_enabled=0 Thread-Index: AQHTtpn9/Ze5cS2EiUWuXPD32on+yw== Date: Thu, 8 Mar 2018 04:57:41 +0000 Message-ID: <20180308045641.7814-24-alexander.levin@microsoft.com> References: <20180308045641.7814-1-alexander.levin@microsoft.com> In-Reply-To: <20180308045641.7814-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0808;7:KDn6x63rUPCdf/mVLeclrkQuhm0uKCP0xTEdvuJgGnFmXFEHpZe4/n3XQ5PIAYBskxg4g9eOut7ro+OHrOkLxxlBJnqc43UELnVjpyRCru3rl62EBzrDBB3NnJePuQhMtyR+PBQPfsoi2jexL1zz3gbVK94IttTyH1g1kTVr7J//zlc4WvQoMtYx/R0V8qSRHcdAyGFG1CwzTog3SRbrAZ+NmxUcBbZpW7yqBun60wtrOufAt1Ku+J4q8svN+xgm;20:Di7WHWoPedGcfqkv6+sRIF2bq41qg1jpU4DXEBQ4cLIRm++9nGWN8i9M73uRHudZkCh3EnEhxqi/d3w0ZHEnefQJXGpEqWXlvXXfpMds4KUF9f3pJH3S2bKE0V6xL4jrHDQH6pqRfMfFvMnnXR8PV6zmLowR/v98crSYwVeV26o= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 9125bf63-ad31-4f7f-33b9-08d584b13398 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0808; x-ms-traffictypediagnostic: DM5PR2101MB0808: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231220)(944501244)(52105095)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB0808;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0808; x-forefront-prvs: 060503E79B x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(396003)(39860400002)(366004)(376002)(346002)(199004)(189003)(22452003)(99286004)(76176011)(2906002)(105586002)(3846002)(86612001)(478600001)(72206003)(14454004)(2900100001)(8676002)(102836004)(68736007)(5660300001)(316002)(6116002)(54906003)(26005)(6506007)(59450400001)(1076002)(86362001)(36756003)(186003)(10090500001)(110136005)(106356001)(4326008)(6512007)(6486002)(7736002)(5250100002)(3280700002)(3660700001)(2501003)(6666003)(81166006)(2950100002)(305945005)(53936002)(107886003)(8936002)(6436002)(81156014)(66066001)(25786009)(10290500003)(97736004)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0808;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: VL3g+4Crjnrb6ilwMIMwIRvV3TAY31W6kxv1Gcd7jZzQF1JEUP0ugjMQfZ0fAoZ/2S+umU03y4IHRUJ0LQIwZUz9MlcdOix1q42CSndaarqrKdnANnFgGhAbtO8zGAGlGwDbOUv5n81J0rvNiCMv5VMbIS9lrZaL7yjh3Oiiyz7Ldm7OxgL8Pm4zI1FEXxDKSr+aoKNtV91qPwXYO6r+S7Cj9OJSIOk0UGOHQPTcaAZLK1859yg+YiBwgrobAnta39AVX4F64HClNnYHGEx6whxDoX89m+pfYL3fS9fkCsvb7Rl9qIx86yibnNc5AH3fowpzrU+qGgGIYUW0TLHf1Q== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9125bf63-ad31-4f7f-33b9-08d584b13398 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Mar 2018 04:57:41.9301 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0808 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guenter Roeck [ Upstream commit 914d65f3f013ba2556c7beec5d3baac7b3292504 ] If handle_boot_enabled is set to 0, the watchdog driver module use counter will not be increased and kref_get() will not be called when registering the watchdog. Subsequently, on open, this does not happen either because the code believes that it was already done because the hardware watchdog is marked as running. We could introduce a state variable to indicate this state, but let's just increase the module use counter and call kref_get() unconditionally if the hardware watchdog is running when a driver is registering itself to keep the code simple. Fixes: 2501b015313fe ("watchdog: core: add option to avoid early ...") Cc: Sebastian Reichel Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin --- drivers/watchdog/watchdog_dev.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_de= v.c index e6edf3737ea7..b30fb637ae94 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -966,14 +966,13 @@ static int watchdog_cdev_register(struct watchdog_dev= ice *wdd, dev_t devno) * and schedule an immediate ping. */ if (watchdog_hw_running(wdd)) { - if (handle_boot_enabled) { - __module_get(wdd->ops->owner); - kref_get(&wd_data->kref); + __module_get(wdd->ops->owner); + kref_get(&wd_data->kref); + if (handle_boot_enabled) queue_delayed_work(watchdog_wq, &wd_data->work, 0); - } else { + else pr_info("watchdog%d running and kernel based pre-userspace handler disa= bled\n", - wdd->id); - } + wdd->id); } =20 return 0; --=20 2.14.1