Received: by 10.213.65.68 with SMTP id h4csp484859imn; Fri, 16 Mar 2018 09:09:16 -0700 (PDT) X-Google-Smtp-Source: AG47ELva5JPF0AyPck+7tP/30G8AJeeBmEKdl0uKQ7Ef5hINSesnDYKyrSfO341oWKOTno2wdCiT X-Received: by 2002:a17:902:bf43:: with SMTP id u3-v6mr2650481pls.227.1521216556946; Fri, 16 Mar 2018 09:09:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521216556; cv=none; d=google.com; s=arc-20160816; b=DrligAMyMs2Hp2KnYFdKucIeaIGvElsyCEpCK8bO42zzhARs/bBqpnK3I/xG4zwtps 8oq1v0QpzaGcDfkehG+A/oxHbw4oJm20wyMBTzqs/IOKv0Lab1ACMTvnR2jf4Mi34l4X dDc0uoAgidfThT/BQaSAfJcbeiCia3S9CJJ7tbZqm0sgEqGQKZykYAlwdk8DtZQm91hF Hiz6eWyUI6ItgpiCKJaTc7wPYTZ12C9LHW9M6wILVtbtv0UgPD6Zm5bY2xC74VtTNJF6 /VMIq5tztAQ1HWZJx//dT/99F2XY4w75HQZo4oGqw/EueJbdYYT2a5laiLDtOtMz/peT XOhg== 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=nN+0Tp2Fn/aK7OWasrac07mO9jPhsJBCgOJhvuEomkQ=; b=ALO5g85NaSAHZX4u300P9hSpcMr3bIcom8qBdyn1Kkz/wdsizPjzmHthExYh6GVjZ1 O2xqr7ernGhpVNhNJqpRAPrj4CunRHXqPPnssBU1f7KkzZTnwgypqBM2zQcoIOTm+bAO uriPMLDo6ncI+8Lv47Mgw3vtI3pLx8Rj3CN6eXGr2l4W6/lVlRDW8gmJzpC8cfn2n4Jq fwpw+4kKcVulORfd6dim1qZwaOH4GqcjX4/s+XUGf4ACEwBxOmPV0KOYw4Ae3ojgE4kR jgf1mme7Es+7OuQssrTwvwU0fB/fFc1QEzQ9NyNaNJyooXRMv/MzsC7ZIEB2IwnYEnZ7 J6Lg== 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 e34-v6si6459273plb.588.2018.03.16.09.09.03; Fri, 16 Mar 2018 09:09:16 -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 S1754812AbeCPQHb (ORCPT + 99 others); Fri, 16 Mar 2018 12:07:31 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44020 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754589AbeCPPlc (ORCPT ); Fri, 16 Mar 2018 11:41:32 -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 53E94F5C; Fri, 16 Mar 2018 15:41:31 +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.15 055/128] rtc: brcmstb-waketimer: fix error handling in brcmstb_waketmr_probe() Date: Fri, 16 Mar 2018 16:23:16 +0100 Message-Id: <20180316152339.581555300@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152336.199007505@linuxfoundation.org> References: <20180316152336.199007505@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.15-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; }