From patchwork Sat Oct 22 07:26:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7528 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105793wrr; Sat, 22 Oct 2022 01:36:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4FxyLtGTqS3fz0Rs4lLLkTttWXR8KkRa0BE6GkuFHIRyJ1gHmUIpoONrp/6LtmzHwBdBwx X-Received: by 2002:a65:6cc7:0:b0:42a:4d40:8dc1 with SMTP id g7-20020a656cc7000000b0042a4d408dc1mr19875686pgw.321.1666427772243; Sat, 22 Oct 2022 01:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427772; cv=none; d=google.com; s=arc-20160816; b=EAr6I2PBit+EdDo4uTMkAfjOc2gbxKXGH65KKnigi8JgxOlm/k3fw3F3P92VNDgUs8 XoBf39Tt/O5xK6mLjlHCXth9iVw3h3dqQ0TV7O8TM7CN8r7V1yPBiQyd33SP9XXrUWF2 2GnEC6bb7cYA9JrH5KCK5xBhSrvLA5vjViw+dBPsYwxUQIXc9FRsq0IJgYBelqEvnUb6 g8gVO7wBrRqmhVJjDIr5qaoSSBU9Q3DtwnrXfjIOeuet7L8hMr5jcW+nJ5yPYmHp2ul1 loRkEvK6+JmKGP1qFQu1PAjB7QVCm6AJMbdVOvC63YLBvlaqO4xP6s2LfW9/WlY9FB1r PwVg== 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=kgkSckYurZfN/msq2+m54lPmQ7kuhtFT72vL1pxX0BUYD3nLw1Cq84xpRyZkoDbqUd qvMGYQVOb7nTm/zZThLTJDP7rrir4Lc1LFfVH9BmnjhWBJf8MBq4U1HyJP9jK1ns5iyw NEuq+xGfalI44SjbGBrrKYWHYVDXz2GWtT6qyhwKk2emAzQo7xfABhd8YjrmBZJgZGfC ld0yi44iEuATEgDKOETPvmHMVnXY1wCHW3vRdEv1IQ0CJiM8yg8rgA5qxCN8/Bj1mhgO U/u3UwA7egma5mE0L1IKabOqzzqFw9elkMJ9fGMb1UWcuUuTEdz7LAAnjXiajmjgyI5B By9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IE28KD4i; 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 mq11-20020a17090b380b00b0020a7e0138d2si10894987pjb.50.2022.10.22.01.35.55; Sat, 22 Oct 2022 01:36:12 -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=IE28KD4i; 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 S233763AbiJVIXE (ORCPT + 99 others); Sat, 22 Oct 2022 04:23:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230127AbiJVIVA (ORCPT ); Sat, 22 Oct 2022 04:21:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B2002DE46D; Sat, 22 Oct 2022 00:58:43 -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 ams.source.kernel.org (Postfix) with ESMTPS id 62E7CB82E2D; Sat, 22 Oct 2022 07:57:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF9D1C433C1; Sat, 22 Oct 2022 07:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425473; bh=b2T9RUet62fU3Ztf9GawhjllprseIO+DUXDl6aQp68Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IE28KD4irLTXgSO4qszzrdtzEebOXgGGCdak0qF5sDzQS6U/9zO6tA/fAFWmnFeRQ m8GOxJIA+t9U5rkfsxG0mSj2ZoKQ91YBrhbJ6jr3bRMzexCat2xiSBCx4iMHZxeZPc wvtbRUycafsIXcA9G5SmYfYUVjrJNO2OMdM92bl0= 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.19 512/717] hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear() Date: Sat, 22 Oct 2022 09:26:31 +0200 Message-Id: <20221022072520.918378507@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376167640899918?= X-GMAIL-MSGID: =?utf-8?q?1747376167640899918?= 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) {