From patchwork Tue Jun 23 19:50:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 223038 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F3C8C433E0 for ; Tue, 23 Jun 2020 21:44:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4153F20B80 for ; Tue, 23 Jun 2020 21:44:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592948686; bh=YsAd++K2D9kAS2XJZYVl1Ca7YxKlSgM03ysJztGuk6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=iR7gF1Z5R+SZbBoYlwtcYG/XQaLPI392j7ob6DFDKtZIwyELL7Wh6p1gEays3GLcr xBuHj3UP2827UAk74piedCJF/7uabmFuQIOCVNhkNWUOpmY6p45JxJpq2p2jvIwkwi Tmpfb/X5QnIk0cXLrWFAQEAowcdAj2gopgQb76rU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387779AbgFWUCM (ORCPT ); Tue, 23 Jun 2020 16:02:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:39202 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387543AbgFWUCH (ORCPT ); Tue, 23 Jun 2020 16:02:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 932462082F; Tue, 23 Jun 2020 20:02:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592942527; bh=YsAd++K2D9kAS2XJZYVl1Ca7YxKlSgM03ysJztGuk6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zRYo+44L613190DBVGackxApRA3AnWtzobGf/oYUuSzHVe8zZtG3imbBEeTem5zGH rbFaYh7oSygyy72fxxjIO7a/ecXREyRFEFY1bqO81YOZGe/2ALRYqHQmx0xN6suR0u ej/6TYIy88HvwCA35pf6uFApnFhLqv4jGLonL9uk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qiushi Wu , Alexandre Belloni , Sasha Levin Subject: [PATCH 5.7 032/477] rtc: mc13xxx: fix a double-unlock issue Date: Tue, 23 Jun 2020 21:50:29 +0200 Message-Id: <20200623195409.116071107@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195407.572062007@linuxfoundation.org> References: <20200623195407.572062007@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Qiushi Wu [ Upstream commit 8816cd726a4fee197af2d851cbe25991ae19ea14 ] In function mc13xxx_rtc_probe, the mc13xxx_unlock() is called before rtc_register_device(). But in the error path of rtc_register_device(), the mc13xxx_unlock() is called again, which causes a double-unlock problem. Thus add a call of the function “mc13xxx_lock” in an if branch for the completion of the exception handling. Fixes: e4ae7023e182a ("rtc: mc13xxx: set range") Signed-off-by: Qiushi Wu Link: https://lore.kernel.org/r/20200503182235.1652-1-wu000273@umn.edu Signed-off-by: Alexandre Belloni Signed-off-by: Sasha Levin --- drivers/rtc/rtc-mc13xxx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c index afce2c0b4bd67..d6802e6191cbe 100644 --- a/drivers/rtc/rtc-mc13xxx.c +++ b/drivers/rtc/rtc-mc13xxx.c @@ -308,8 +308,10 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev) mc13xxx_unlock(mc13xxx); ret = rtc_register_device(priv->rtc); - if (ret) + if (ret) { + mc13xxx_lock(mc13xxx); goto err_irq_request; + } return 0;