Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3628414pxb; Mon, 24 Jan 2022 13:54:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJww9S6bG3ZCewDAeypRBeVHs6oIdmFDFeTYdsUD6BZ/tg0X8WPZHliCcEJJ0SsWebMxwpPb X-Received: by 2002:a17:90a:764f:: with SMTP id s15mr329970pjl.80.1643061255627; Mon, 24 Jan 2022 13:54:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643061255; cv=none; d=google.com; s=arc-20160816; b=VoaztndndhPhnlsXap8k8kQIDpm7yuGi3Udd6zeJdfz+byhNLAU38jBg78Yq/e/DVc deIFrgp+N2j5av2GzVqx6cRBPr5SABxjFJqtyk+9xRteoRjdW20YmlAqRMR1n2LWf7qm 9IWv9vcRZoPwIY9v8rhAjWav2fDjqvnYijrTbaVrQ2Gzn88HaSrzyYqOF1wtq3DY5KR+ p6qaHSp1mu3+CLGd5l37Mc6PhyupVHI/GiL1yAltWfQf3QaGKgcXMyjsWdatnNFFItAP 9pJBv9547MK1MIgR5IlW/WqIrFnoaFf1fhtgDzpnnlwnJ9UmdFLWSBEETrFsk8Iyz+Xd zO7w== 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=rOL6CS18Sj6lwK9r6u7IN8NpJ9Emgonkg+Os1Zidnjw=; b=IF5Io8QI/ye2bFsea3PhLuHZOOAqJBhM3gIH4p9Ik6/TLj8+MhiMHx6yrIY0mNBYRg ZlXRNbuc8SKH8hlm/fFSLhbR1P03CKVff1rALu9uOl4J35CNWucuwxgSgzWWUWiUihJn gE9L9ILspyJ0t+uo0OmKm1OZSb6v9DhjWeu22d8E7gjHZKzYPbTUJFGtf1FD9Zp8Jk9+ Qyi4nOj5bOx1KHq5hh3YbMtj4h9dqGammAhSO+0fk10LrXTkQxkkER/9b6ah/UkZ2ZGc yDuPsg/MNBNsAP9XOhowaJTOf63e/bRz3qUtAEpXp1OzzPPZ+4qGaZRF4SkMOyg75kmm Rbqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p+kNFVc8; 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 68si2241746pfw.137.2022.01.24.13.54.02; Mon, 24 Jan 2022 13:54:15 -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=p+kNFVc8; 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 S1456897AbiAXVkS (ORCPT + 99 others); Mon, 24 Jan 2022 16:40:18 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54806 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445114AbiAXVCO (ORCPT ); Mon, 24 Jan 2022 16:02:14 -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 dfw.source.kernel.org (Postfix) with ESMTPS id C28E261365; Mon, 24 Jan 2022 21:02:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9860FC340E5; Mon, 24 Jan 2022 21:02:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058133; bh=elCfbszIBuVRR6VjRT0ZBLCHfXRupXPKDV8BynvhD0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p+kNFVc8FI3Kk3oBQCB8caq/D/BcEIXWRY39hNLyS4RngmnSdaKZ1+2NEAvRvqqfy txUFP+KLt7SsvNhGfRBwjEkTxwr9GYBKSiMT7fNyVBp3Xd+FaxkeoEhQOWaBMEDl4F oQBFwQvTIMwkZ4Y+5z2vsELbLOpKYWHLl1UmsBZY= 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.16 0189/1039] media: imx-pxp: Initialize the spinlock prior to using it Date: Mon, 24 Jan 2022 19:32:58 +0100 Message-Id: <20220124184131.658280532@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 723b096fedd10..b7174778db539 100644 --- a/drivers/media/platform/imx-pxp.c +++ b/drivers/media/platform/imx-pxp.c @@ -1659,6 +1659,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) { @@ -1676,8 +1678,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