Received: by 10.213.65.68 with SMTP id h4csp467140imn; Fri, 16 Mar 2018 08:37:51 -0700 (PDT) X-Google-Smtp-Source: AG47ELst+paID2fwjd0qR2r8VKmxAWpT8tNo9NSNasfdghjMWKCQxEuiTA2bxWYloZrxDsXLQ+Ri X-Received: by 10.99.0.2 with SMTP id 2mr1868551pga.106.1521214671889; Fri, 16 Mar 2018 08:37:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521214671; cv=none; d=google.com; s=arc-20160816; b=ixMcWZj+NSNwMYGCTQhl1Cn2PK/3V8ytGuC748v/1hGh0j4arviIn23rHi/G7Nfrqr 1TVo5WOobrxpq83hYtig4sxNRyBsCJS4FqKoxvVZqkhXfRzlORZcJVz4vu99nPwZ7SS4 URC+hBJpH36BgjkDdTgQAbSwRGDM+aJ4cDmqzSivJSnuZcbLaGM17sX+AspXnP/QSL8C 5KKCkeA15dF7Wtmb1qCHZrf8V6rV5/1tlO94H1Ge4Fj342haqJlW7c5f1pMuKRyA1rnS KZDJRSdfMHCynIOlGWt1VNSJtSuFyjOiSohP4iFEyKMx85u/QVU7PBygkE8+7xxeCWmb PgTw== 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=m208RTGg+/kHSgHfPGePYKesr1GQG2oS3vlsxXkMs1c=; b=VVKjy9ux2SA8+hQ2ro40s5L+sAOAL/GFqai0cQA+z8Tzwif9u5dpa2BMakN/qY0f9J MdlE1LSfos3AamlgE/Ac8lnnBUz01BRJzZ+pi3Ja8TwN6owiREort1AusCyldEMh6Cqh Hl5cI48XzWknqvSBS7XhpsuK5BM5gmLCC4j3UWouiMEwCx8ootciFjX13BhZksEx41w0 i+yaRdH/M9LcBGC5WP9eyPVSn+4hWk1bbwbaVwN5LtdidOQJL9ECHwNWxOPjqiOXe2ka 9/iNzXvuC4CzFsG48dQJKXRTRWi5yh465vFG1RLVm5PCdhy/xnbvyFee0SmT1O5Wd5lP ui1g== 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 s18si5113600pgd.65.2018.03.16.08.37.37; Fri, 16 Mar 2018 08:37:51 -0700 (PDT) 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 S934211AbeCPPfy (ORCPT + 99 others); Fri, 16 Mar 2018 11:35:54 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40022 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754379AbeCPPfv (ORCPT ); Fri, 16 Mar 2018 11:35:51 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5367110A5; Fri, 16 Mar 2018 15:35:50 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Khoroshilov , Florian Fainelli , Alexandre Belloni , Sasha Levin Subject: [PATCH 4.14 046/109] rtc: brcmstb-waketimer: fix error handling in brcmstb_waketmr_probe() Date: Fri, 16 Mar 2018 16:23:15 +0100 Message-Id: <20180316152332.473085457@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152329.844663293@linuxfoundation.org> References: <20180316152329.844663293@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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: Alexey Khoroshilov [ Upstream commit f2eef045de9defbc6fc6b72b17f0941cbe26c81d ] brcmstb_waketmr_probe() does not disable timer->clk on error paths. Found by Linux Driver Verification project (linuxtesting.org). Fixes: c4f07ecee22e ("rtc: brcmstb-waketimer: Add Broadcom STB wake-timer") Signed-off-by: Alexey Khoroshilov Reviewed-by: Florian Fainelli Signed-off-by: Alexandre Belloni Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/rtc/rtc-brcmstb-waketimer.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) --- a/drivers/rtc/rtc-brcmstb-waketimer.c +++ b/drivers/rtc/rtc-brcmstb-waketimer.c @@ -253,7 +253,7 @@ static int brcmstb_waketmr_probe(struct ret = devm_request_irq(dev, timer->irq, brcmstb_waketmr_irq, 0, "brcmstb-waketimer", timer); if (ret < 0) - return ret; + goto err_clk; timer->reboot_notifier.notifier_call = brcmstb_waketmr_reboot; register_reboot_notifier(&timer->reboot_notifier); @@ -262,12 +262,21 @@ static int brcmstb_waketmr_probe(struct &brcmstb_waketmr_ops, THIS_MODULE); if (IS_ERR(timer->rtc)) { dev_err(dev, "unable to register device\n"); - unregister_reboot_notifier(&timer->reboot_notifier); - return PTR_ERR(timer->rtc); + ret = PTR_ERR(timer->rtc); + goto err_notifier; } dev_info(dev, "registered, with irq %d\n", timer->irq); + return 0; + +err_notifier: + unregister_reboot_notifier(&timer->reboot_notifier); + +err_clk: + if (timer->clk) + clk_disable_unprepare(timer->clk); + return ret; }