Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3573380pxb; Mon, 24 Jan 2022 12:33:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwfoQvjmahAAaEauCz71DqaQ/X9g+hPZEi9IcMCryuzOoWQ8SpZ6cWCwa1HRupqilYiwcur X-Received: by 2002:a63:3dcb:: with SMTP id k194mr12897957pga.619.1643056278640; Mon, 24 Jan 2022 12:31:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056278; cv=none; d=google.com; s=arc-20160816; b=MIf6Qmv2/M5kYOV8uNGKT9TyMXU3uJikZW6MqjNMi+TSKNTW2eQbz/96ulFfyM5Z+e +miyMfe+u0M/+YNRWBfJCFrnQQZqbgVZoXr4PpT/+leme3AVS55JIWvDU5AKlEC3dzV1 wMv/1/38dcj+UqFY6ZV4wcI4fxiik/y9nxBJene8pjqgUGo0DEpyGymAsbmJwiFDoxMo Qr9nS0qu/Bt6ToREYTO7BS03xUmtGGHwwq4ljHND2eZw2KAF+nGkzdRH9Nit5cG1PqVn aBsRgwNTnvW/tJzS8pfleC+uNlT4RkjnXO4z+Q0guzGXMBZrTQIFmFsHkPdrxbxbnJ69 yeCQ== 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=MB0kpG5uii8HedjOv15JEgHdw6Eirlzc+SRQiOuL4D4=; b=UL/+9lKi2/b8gJjkA8kqTBkGDVfPzmMvqCSW5BD0adWGGxoSzrQvP9at+TeCGbP/xo ZnQaSSBy/TBpMyuPINB8M/VZ/2hd3mDYzjGfW8A+j3p/HGMmQ6PSxvvZ7HgxDHvDmgWW Hr8dI77vmcGIzxgb+qBv8bB6RTqzrE6TCrS6nVwe5HuS0d0Jd2oTM6Bp+sLvt2xKyrY3 Bf6qmXbIuAUzp4tMylKahByGtr5JMm+bETCeTwD1N44e6CnaEhIH70xjYErsEV1fHPrp eRHMPwFuNefZWABxxIGZ4g1OW9UD+zNcxnHk1mKdgkdFq+RRD3hjwCWXGNvKWsYkYKDt fMEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="aOT/0oz6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q20si12568481plk.173.2022.01.24.12.31.04; Mon, 24 Jan 2022 12:31:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="aOT/0oz6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1353666AbiAXTfK (ORCPT + 99 others); Mon, 24 Jan 2022 14:35:10 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50606 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351509AbiAXT1R (ORCPT ); Mon, 24 Jan 2022 14:27:17 -0500 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 127E1B81238; Mon, 24 Jan 2022 19:27:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38CECC340E5; Mon, 24 Jan 2022 19:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052434; bh=jo1QdWXfxk/xuGISj2AdjzU5SrJsUUu9kwioQXF1HGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aOT/0oz635qDGSYXk/pQmnkqzBfASksYTYQ2drrwNRx9OCtd7h7GoeP8piNN/JKka rM6lRfNl2xfatSYprnO4syCQq5dMpflakGHVGlCkVPGCo3OsHh1t0w5Wt+RzaonMJw 20Bl2qM+kLl7Z9mMfvZlGkQsTdaBPR3WoJVtCO3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabio Estevam , Philipp Zabel , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 056/320] media: imx-pxp: Initialize the spinlock prior to using it Date: Mon, 24 Jan 2022 19:40:40 +0100 Message-Id: <20220124183955.640446385@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fabio Estevam [ Upstream commit ed2f97ad4b21072f849cf4ae6645d1f2b1d3f550 ] After devm_request_threaded_irq() is called there is a chance that an interrupt may occur before the spinlock is initialized, which will trigger a kernel oops. To prevent that, move the initialization of the spinlock prior to requesting the interrupts. Fixes: 51abcf7fdb70 ("media: imx-pxp: add i.MX Pixel Pipeline driver") Signed-off-by: Fabio Estevam Reviewed-by: Philipp Zabel Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/imx-pxp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/imx-pxp.c b/drivers/media/platform/imx-pxp.c index 38d9423223025..3c36cefddec7c 100644 --- a/drivers/media/platform/imx-pxp.c +++ b/drivers/media/platform/imx-pxp.c @@ -1664,6 +1664,8 @@ static int pxp_probe(struct platform_device *pdev) if (irq < 0) return irq; + spin_lock_init(&dev->irqlock); + ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, pxp_irq_handler, IRQF_ONESHOT, dev_name(&pdev->dev), dev); if (ret < 0) { @@ -1681,8 +1683,6 @@ static int pxp_probe(struct platform_device *pdev) goto err_clk; } - spin_lock_init(&dev->irqlock); - ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); if (ret) goto err_clk; -- 2.34.1