From patchwork Mon Oct 24 11:32:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9427 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp478925wru; Mon, 24 Oct 2022 07:18:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4AGqXVK+IlltGXS89CFW+aG/+QPxRRnM5S7toN0V9lw97qtnenkNSxTd83Q7qFeMX+Ocal X-Received: by 2002:a05:6402:1906:b0:45d:db20:7709 with SMTP id e6-20020a056402190600b0045ddb207709mr30256216edz.406.1666621093101; Mon, 24 Oct 2022 07:18:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621093; cv=none; d=google.com; s=arc-20160816; b=zM7yGn7uGkT+W7Y1yBfMNqZ9CxYkr0yBEvAMmC76bCTIyLy648pjES3Olk5zYtbLz3 PvZ6hPiDtRqiZqBdm+Tl+4pctmDZ3qIIO0dMYx1CSENtnTKrKFPQtpYsc4M5dQxogSEp RfLK6kSIBHk4zRAL0p3mfiziKp43Aom6cFOSevCf5RS8jfaW9jneN8HfcFPHC5P4uga4 bOKy+ISUxR8f+4G+R7kO4Shsa6KBrrSeWgNkEMJa4ALKtyVuYVZlj0mJ7EncRSbibl9p UW5foY2Ov5eLfn3hB1IjhvDUNjnv0fxVuc3nA4Tf2lmZZOcR02hAN7apI7W9pTy3hpnQ eYXA== 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=Q/v9+hCYN23aUlx7E08CfeR6SDQ/ghKOiJPbb6JjnWA=; b=X7KQXQQaxARiyyb+/9pLcCN6TDF0Zky3xDPbtecd+HSSQlQmhbDeoEHi20umlB7rYn TATSFhBfofGECm2uhF3EWnAhyKPoilXcE+DQ2t8SLzZMt8fMmET3KGax0Rs7AKm9/M4t /qVtHto2uUfwj138mylV2pvnJp0baAyO/7jBTsPWDnNOwjc9Bk3aBXaNjJOrZKpteqjN j33HVkPJ85xqU7hjPX44Yt8iP1ajI4zElOEFBZ1pUDMnO4hkg5JEya/d2tLVOVIYZyt9 YQeZpIkTT3o3fI7FlmCV4rMO0gHuftuCuRVeg3hhI5FA5zYXbRMYrOvgo5skYZhOKhal 4QCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tpn2EMnO; 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 hz2-20020a1709072ce200b0079ca59305a6si9995783ejc.354.2022.10.24.07.17.44; Mon, 24 Oct 2022 07:18:13 -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=tpn2EMnO; 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 S234088AbiJXOMO (ORCPT + 99 others); Mon, 24 Oct 2022 10:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235429AbiJXOJM (ORCPT ); Mon, 24 Oct 2022 10:09:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2430AC5100; Mon, 24 Oct 2022 05:51:23 -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 E6BE661290; Mon, 24 Oct 2022 12:49:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 039B3C433C1; Mon, 24 Oct 2022 12:49:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615769; bh=b2T9RUet62fU3Ztf9GawhjllprseIO+DUXDl6aQp68Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tpn2EMnOxI5ouoamlE1ezIKotiL/uL1WYRej028XQSeutA5CmyOytVmk3BZaU/euM dboETEO3OVq52TMJjfJg3kW+WPkHY7oP7wxl+8oCWotZgVI/GLnqkYzgohWTUdZf+i nHl5GSEMyF0ruk4xpJolPLFOXE1I29ahs4OXoMCI= 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.15 377/530] hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear() Date: Mon, 24 Oct 2022 13:32:01 +0200 Message-Id: <20221024113102.098719716@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@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?1747578879526141382?= X-GMAIL-MSGID: =?utf-8?q?1747578879526141382?= 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 @@ -270,13 +270,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; @@ -290,6 +283,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) {