Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp167913imn; Fri, 29 Jul 2022 03:26:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tFPdmKyLierFPIWqRJ55B6RByh2IT2vGmEM3kjTqf1E4PXb5QpJypFcibHYcfXJGK5/7e9 X-Received: by 2002:a17:907:d29:b0:72b:4b20:5650 with SMTP id gn41-20020a1709070d2900b0072b4b205650mr2375443ejc.350.1659090389454; Fri, 29 Jul 2022 03:26:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659090389; cv=none; d=google.com; s=arc-20160816; b=GI8zHTAPtePf4a61pmMxYjoRxrfXNrEPGYQBR2xWN8ZPaZ1pWdHZlfAjqCQPw6X6ra /xWfzlbwvhckfC+uJPJC0lheKehSqbZxZg4Mnkk5n9XqCsyY1qGaFrOFLU4aDnqT+4cV kc58xwGz5i00dY8IlixDuxS0K3MjZV5h7j2kp2H3pJW4p0+AQC6JZp3c7/EgZ/mzQEsC VumRfS2AGQKfkANHM3cdWp5URV5nDx+VnorstJolw0juE2YY2ii/C+Btj12+SsUxt+Sw BOsuqFBEXXht/4lj2gfkWu0nXeoeulE1H0crgCmVP19q9u5JFhIYsJE+pa07lJmseali 3/gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=0tDIz+PF7DR8rcVJU+Tkzx6WHLOMGXNWscI8J8uOer4=; b=N2jCGt4iSH74igkLz/pu2OslBYUL1uBnMBt3fk9VHDoA6N4AJKOdSEo2TxvLD/ac4l JoLqURUTI9Awn8UPRVRTLfM+dIgtSwppxwRRegR5ucWvqdLFK7EtiTTOmZD4KGGxhoHJ 2Hs1DySUylPJqFCmNp87Fa0S55izVYSr1+eecCA6vn3jt0TsuK/4PVv6TY0D4ieGoyZo Lh07VCxAq3MJf9sT66luIFgtwihZeau6c/F3GepJMlbnukBpPn2b2MKusJVtBTT976kK 3uvAGHPK6lINOLBWyWNxfCGjNN5yK8JAldOfum79i7ALagtJENg1/+O9CY2mCWav2ULV arDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt18-20020a1709072d9200b0072ef491cc0dsi3584845ejc.113.2022.07.29.03.25.55; Fri, 29 Jul 2022 03:26:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235509AbiG2KV4 (ORCPT + 99 others); Fri, 29 Jul 2022 06:21:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235375AbiG2KVz (ORCPT ); Fri, 29 Jul 2022 06:21:55 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D65AB77579 for ; Fri, 29 Jul 2022 03:21:54 -0700 (PDT) Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[127.0.0.1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1oHN7j-0002Ai-P4; Fri, 29 Jul 2022 12:21:39 +0200 Message-ID: Date: Fri, 29 Jul 2022 12:21:31 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v1] Moving init_completion before request_irq Content-Language: en-US To: Kshitiz Varshney , Horia Geanta , Pankaj Gupta , Varun Sethi , Herbert Xu , "David S . Miller" , Iuliana Prodan , Gaurav Jain , Rahul Kumar Yadav , Vabhav Sharma , Sahil Malhotra , Matt Mackall , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Steffen Trumtrar , PrasannaKumar Muralidharan , Martin Kaiser Cc: linux-imx@nxp.com, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20220729100211.2204126-1-kshitiz.varshney@nxp.com> From: Ahmad Fatoum In-Reply-To: <20220729100211.2204126-1-kshitiz.varshney@nxp.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: a.fatoum@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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-crypto@vger.kernel.org Hello Kshitiz, On 29.07.22 12:02, Kshitiz Varshney wrote: > Issue: > While servicing interrupt, trying to access variable rng_op_done, > which is not yet initalized hence causing kernel to crash > while booting. > > Fix: > Moving initialization of rng_op_done before request_irq. > > Fixes: 1d5449445bd0 (hwrng: mx-rngc - add a driver for Freescale RNGC) > Signed-off-by: Kshitiz Varshney Thanks for your patch. > + init_completion(&rngc->rng_op_done); > + > ret = devm_request_irq(&pdev->dev, > irq, imx_rngc_irq, 0, pdev->name, (void *)rngc); This should probably be moved below imx_rngc_irq_mask_clear(rngc). init_completion can stay where it is. That way: - You initialize rngc fully before registering the IRQ handler - You don't handle pending IRQs that you want to dismiss anyway - If the IRQ happens to be because of a SEED_DONE due to a previous boot stage, you don't end up completing the completion prematurely. Cheers, Ahmad > if (ret) { > @@ -277,7 +279,6 @@ static int imx_rngc_probe(struct platform_device *pdev) > goto err; > } > > - init_completion(&rngc->rng_op_done); > > rngc->rng.name = pdev->name; > rngc->rng.init = imx_rngc_init; -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |