From patchwork Mon Oct 24 11:31:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9279 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp462935wru; Mon, 24 Oct 2022 06:46:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM75qfFAEvSVVWKT3SpiHNyi3pGUBJDZ7DsGR12hXkB035Y6TCxMWN+wb3A386rSGMiHYN8Q X-Received: by 2002:a63:2155:0:b0:455:7b5b:c2d7 with SMTP id s21-20020a632155000000b004557b5bc2d7mr28024816pgm.309.1666619207661; Mon, 24 Oct 2022 06:46:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619207; cv=none; d=google.com; s=arc-20160816; b=ozLPU7XzfEVAcSYNP1BjAeFI/PlmVsfn+Irbdxl/2bvtycQEVGk5jN6v09eJHXpanP Xhc3eqGf1aDMiwgMEmGzYVyj/uY/R4DL1jm09xDOvq84YQhDDuHQh4+xM0sULz7kNT1u EWWlzWDheqKtKeJhcGJKXqKaeWKYgTILdRYN+FfnlsBC0zEP7nffUFN67dLV2Nyitzmq kcFKOYRkAAgaGNeW3MBG06EJzl6Gl2gGjqwp70koYKsakLFwGEvGmJsw4Aei4atAfv8A xYeUchGFbD7EnuA+0ZPM91xqi33RZgbteMjt+o+CzrZaAMEKXjtnymI09cCEP5ZBSY1w 1QVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JGMzoFWCauJr2CtVUPPX4n6ToV4XjybX+EyPEYqvG6c=; b=mtzRObtRuNPg4D9hEDhbw2rt2kocZ8pwBgdMz7HcxbQGLR1G+QnIpMJ/2HznJkx3oh ni9DIPZjE0ryMMNltuCXsYdObGXdrLyAMjgKIkuGtx9dfFkEsqIXGmvfO0Cs7hYx0iAZ Gzv/Vuh6gZmoeZVEzBUxCgdtlR8Tf7Ra3MwOueQX8LIpXa9k0x1E/7lBHLrGrlaMr0L+ J826Ht1uI+cDFTuRM8aKfFZKTFXpp5WxM/gjLU4UHTG4ZQh/hUIKUqSk9z6SN8bV0/1W 2HnRs2lXo3C8vuM3pGKwdTNLNB3Qfn9tkNLagmtEs6CWXx2EUS1ZvgFchLbQhhsCRKyT uUiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2LYwmQaz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x5-20020a654145000000b0046b3d6b786asi29114226pgp.186.2022.10.24.06.46.33; Mon, 24 Oct 2022 06:46:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2LYwmQaz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236278AbiJXNnT (ORCPT + 99 others); Mon, 24 Oct 2022 09:43:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236874AbiJXNl1 (ORCPT ); Mon, 24 Oct 2022 09:41:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E21788997B; Mon, 24 Oct 2022 05:39:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B88ED612A5; Mon, 24 Oct 2022 12:27:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5F98C4314D; Mon, 24 Oct 2022 12:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614471; bh=ErzLkvRPieZMIDkHWj/wB4j77OLnn1K+rJFllpPoBzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2LYwmQazhwsg+yPfG5tkbTl22368r5lqm5GiG5NXMzDsZSQvx3P/BcUVmrQd2pWc/ 6yPL2W+zmp1oJ11iYQQmH59eVw8WuaYXCFOzRc151pv1SviJI+GTBZXfQbKydnFLwM wQdGivjSc1ARN7DvHKJaQeYSXfsIIUaPkIBvdzkI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kshitiz Varshney , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 273/390] hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear() Date: Mon, 24 Oct 2022 13:31:10 +0200 Message-Id: <20221024113034.548746044@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576901812241570?= X-GMAIL-MSGID: =?utf-8?q?1747576901812241570?= From: Kshitiz Varshney [ Upstream commit 10a2199caf437e893d9027d97700b3c6010048b7 ] Issue: While servicing interrupt, if the IRQ happens to be because of a SEED_DONE due to a previous boot stage, you end up completing the completion prematurely, hence causing kernel to crash while booting. Fix: Moving IRQ handler registering after imx_rngc_irq_mask_clear() Fixes: 1d5449445bd0 (hwrng: mx-rngc - add a driver for Freescale RNGC) Signed-off-by: Kshitiz Varshney Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/char/hw_random/imx-rngc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/drivers/char/hw_random/imx-rngc.c +++ b/drivers/char/hw_random/imx-rngc.c @@ -272,13 +272,6 @@ static int imx_rngc_probe(struct platfor goto err; } - ret = devm_request_irq(&pdev->dev, - irq, imx_rngc_irq, 0, pdev->name, (void *)rngc); - if (ret) { - dev_err(rngc->dev, "Can't get interrupt working.\n"); - goto err; - } - init_completion(&rngc->rng_op_done); rngc->rng.name = pdev->name; @@ -292,6 +285,13 @@ static int imx_rngc_probe(struct platfor imx_rngc_irq_mask_clear(rngc); + ret = devm_request_irq(&pdev->dev, + irq, imx_rngc_irq, 0, pdev->name, (void *)rngc); + if (ret) { + dev_err(rngc->dev, "Can't get interrupt working.\n"); + return ret; + } + if (self_test) { ret = imx_rngc_self_test(rngc); if (ret) {